Browse code

Add withRedirect; deprecate redirect

RafaƂ Szklarczyk authored on 10/07/2019 14:13:32
Showing 1 changed files
... ...
@@ -47,6 +47,10 @@ class Response{
47 47
         return $this;
48 48
     }
49 49
 
50
+    public function withRedirect($url){
51
+        return $this->withHeader("Location", $url);
52
+    }
53
+
50 54
     public function send(){
51 55
         if(!headers_sent()){
52 56
             if(isset($this->reasonPhrase)&&$this->reasonPhrase!=""){
... ...
@@ -61,6 +65,8 @@ class Response{
61 65
     }
62 66
 
63 67
     public function redirect($url, $code=null){
68
+        throw new \Exception("method deprecated use withRedirect()!");
69
+
64 70
         if(isset($code)){
65 71
             http_response_code($code);
66 72
         }