@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * This method need at least 2 arguments: route pattern and callable. |
| 117 | 117 | * You can create midleware callables which will be executed before the route |
| 118 | - * @return type |
|
| 118 | + * @return Router |
|
| 119 | 119 | */ |
| 120 | 120 | public function post() { |
| 121 | 121 | return $this->url(Route::METHOD_POST, func_get_args()); |
@@ -198,6 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * Method called when route cant be found |
| 201 | + * @param \Closure $callback |
|
| 201 | 202 | */ |
| 202 | 203 | public function notFound($callback) { |
| 203 | 204 | $this->errorHandler['notFound'] = $callback; |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | echo "Hello"; |
| 44 | 44 | }); |
| 45 | 45 | $this->router->get("/hello/:id", function($id) { |
| 46 | - echo "Hello " . $id; |
|
| 46 | + echo "Hello ".$id; |
|
| 47 | 47 | }); |
| 48 | 48 | $this->router->post("/world/", function() { |
| 49 | 49 | echo "world"; |
| 50 | 50 | }); |
| 51 | 51 | $this->router->post("/world/:id", function($id) { |
| 52 | - echo $id . " world"; |
|
| 52 | + echo $id." world"; |
|
| 53 | 53 | }); |
| 54 | 54 | $this->router->map(["get", "post"], "/map/", function() { |
| 55 | 55 | echo "map"; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | $this->expectOutputString("Hello"); |
| 85 | 85 | $output .= "Hello"; |
| 86 | 86 | $this->router->dispatch("/hello/", "post"); |
| 87 | - $this->expectOutputString($output . "Page not found"); |
|
| 87 | + $this->expectOutputString($output."Page not found"); |
|
| 88 | 88 | $output .= "Page not found"; |
| 89 | 89 | $this->router->dispatch("/hello/world", "get"); |
| 90 | - $this->expectOutputString($output . "Hello world"); |
|
| 91 | - $output.="Hello world"; |
|
| 90 | + $this->expectOutputString($output."Hello world"); |
|
| 91 | + $output .= "Hello world"; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | public function testRouterPost() { |
| 100 | 100 | $output = ""; |
| 101 | 101 | $this->router->dispatch("/world/", "post"); |
| 102 | - $this->expectOutputString($output . "world"); |
|
| 102 | + $this->expectOutputString($output."world"); |
|
| 103 | 103 | $output .= "world"; |
| 104 | 104 | $this->router->dispatch("/world/", "get"); |
| 105 | - $this->expectOutputString($output . "Page not found"); |
|
| 105 | + $this->expectOutputString($output."Page not found"); |
|
| 106 | 106 | $output .= "Page not found"; |
| 107 | 107 | $this->router->dispatch("/world/hello", "post"); |
| 108 | - $this->expectOutputString($output . "hello world"); |
|
| 108 | + $this->expectOutputString($output."hello world"); |
|
| 109 | 109 | $output .= "Hello world"; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | public function testRouterMap() { |
| 119 | 119 | $output = ""; |
| 120 | 120 | $this->router->dispatch("/map/", "post"); |
| 121 | - $this->expectOutputString($output . "map"); |
|
| 121 | + $this->expectOutputString($output."map"); |
|
| 122 | 122 | $output .= "map"; |
| 123 | 123 | $this->router->dispatch("/map/", "get"); |
| 124 | - $this->expectOutputString($output . "map"); |
|
| 124 | + $this->expectOutputString($output."map"); |
|
| 125 | 125 | $output .= "map"; |
| 126 | 126 | $this->router->dispatch("/map/", "options"); |
| 127 | - $this->expectOutputString($output . "Page not found"); |
|
| 127 | + $this->expectOutputString($output."Page not found"); |
|
| 128 | 128 | $output .= "Page not found"; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | public function testRouteUpdate() { |
| 137 | 137 | $output = ""; |
| 138 | 138 | $this->router->dispatch("/upd/", "update"); |
| 139 | - $this->expectOutputString($output . "upd"); |
|
| 139 | + $this->expectOutputString($output."upd"); |
|
| 140 | 140 | $output .= "upd"; |
| 141 | 141 | $this->router->dispatch("/upd/", "get"); |
| 142 | - $this->expectOutputString($output . "Page not found"); |
|
| 142 | + $this->expectOutputString($output."Page not found"); |
|
| 143 | 143 | $output .= "Page not found"; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | public function testRouteDelete() { |
| 152 | 152 | $output = ""; |
| 153 | 153 | $this->router->dispatch("/del/", "delete"); |
| 154 | - $this->expectOutputString($output . "del"); |
|
| 154 | + $this->expectOutputString($output."del"); |
|
| 155 | 155 | $output .= "del"; |
| 156 | 156 | $this->router->dispatch("/del/", "post"); |
| 157 | - $this->expectOutputString($output . "Page not found"); |
|
| 157 | + $this->expectOutputString($output."Page not found"); |
|
| 158 | 158 | $output .= "Page not found"; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | public function testRouteMiddleware() { |
| 167 | 167 | $output = ""; |
| 168 | 168 | $this->router->dispatch("/middle/", "get"); |
| 169 | - $this->expectOutputString($output . "mid1 mid2 end"); |
|
| 169 | + $this->expectOutputString($output."mid1 mid2 end"); |
|
| 170 | 170 | $output .= "mid1 mid2 end"; |
| 171 | 171 | $this->router->dispatch("/middle/", "post"); |
| 172 | - $this->expectOutputString($output . "Page not found"); |
|
| 172 | + $this->expectOutputString($output."Page not found"); |
|
| 173 | 173 | $output .= "Page not found"; |
| 174 | 174 | } |
| 175 | 175 | |