@@ -13,7 +13,7 @@ |
||
13 | 13 | "info" => "Just say hi.", |
14 | 14 | "method" => null, |
15 | 15 | "path" => "", |
16 | - "handler" => function () { |
|
16 | + "handler" => function() { |
|
17 | 17 | return ["Anax: Just saying Hi!", 200]; |
18 | 18 | }, |
19 | 19 | ], |
@@ -13,7 +13,7 @@ |
||
13 | 13 | "info" => "Just say hi with a string.", |
14 | 14 | "method" => null, |
15 | 15 | "path" => "hi", |
16 | - "handler" => function () { |
|
16 | + "handler" => function() { |
|
17 | 17 | //echo "Ho"; |
18 | 18 | return "Hi."; |
19 | 19 | }, |
@@ -6,15 +6,15 @@ |
||
6 | 6 | global $di; |
7 | 7 | $router = $di->get("router"); |
8 | 8 | |
9 | -$router->addInternalRoute("403", function () { |
|
9 | +$router->addInternalRoute("403", function() { |
|
10 | 10 | return ["Anax 403: Forbidden", 403]; |
11 | 11 | }, "403 Forbidden."); |
12 | 12 | |
13 | -$router->addInternalRoute("404", function () { |
|
13 | +$router->addInternalRoute("404", function() { |
|
14 | 14 | return ["Anax 404: Not Found", 404]; |
15 | 15 | }, "404 Not Found."); |
16 | 16 | |
17 | -$router->addInternalRoute("500", function () { |
|
17 | +$router->addInternalRoute("500", function() { |
|
18 | 18 | // echo "<pre>"; |
19 | 19 | // debug_print_backtrace(); |
20 | 20 | return ["Anax 500: Internal Server Error", 500]; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | return [ |
9 | 9 | //"mode" => Router::DEVELOPMENT, // default, verbose execeptions |
10 | - "mode" => Router::PRODUCTION, // exceptions turn into 500 |
|
10 | + "mode" => Router::PRODUCTION, // exceptions turn into 500 |
|
11 | 11 | |
12 | 12 | // Path where to mount the routes, is added to each route path. |
13 | 13 | "mount" => null, |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | "info" => "Just say hi.", |
20 | 20 | "method" => null, |
21 | 21 | "path" => "", |
22 | - "handler" => function () { |
|
22 | + "handler" => function() { |
|
23 | 23 | return ["Anax: Just saying Hi!", 200]; |
24 | 24 | }, |
25 | 25 | ], |
@@ -6,7 +6,7 @@ |
||
6 | 6 | "services" => [ |
7 | 7 | "router" => [ |
8 | 8 | "shared" => true, |
9 | - "callback" => function () { |
|
9 | + "callback" => function() { |
|
10 | 10 | $router = new \Anax\Route\Router(); |
11 | 11 | $router->setDI($this); |
12 | 12 |
@@ -24,16 +24,16 @@ |
||
24 | 24 | { |
25 | 25 | self::$di = new DIFactoryConfig(); |
26 | 26 | self::$di->loadServices([ |
27 | - "services" => [ |
|
28 | - "user" => [ |
|
29 | - "active" => false, |
|
30 | - "shared" => true, |
|
31 | - "callback" => function () { |
|
32 | - $obj = new MockHandlerDiService(); |
|
33 | - return $obj; |
|
34 | - } |
|
35 | - ], |
|
36 | - ], |
|
27 | + "services" => [ |
|
28 | + "user" => [ |
|
29 | + "active" => false, |
|
30 | + "shared" => true, |
|
31 | + "callback" => function () { |
|
32 | + $obj = new MockHandlerDiService(); |
|
33 | + return $obj; |
|
34 | + } |
|
35 | + ], |
|
36 | + ], |
|
37 | 37 | ]); |
38 | 38 | } |
39 | 39 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | "user" => [ |
29 | 29 | "active" => false, |
30 | 30 | "shared" => true, |
31 | - "callback" => function () { |
|
31 | + "callback" => function() { |
|
32 | 32 | $obj = new MockHandlerDiService(); |
33 | 33 | return $obj; |
34 | 34 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $route = new Route(); |
18 | 18 | |
19 | - $route->set(null, null, "search/{arg1}", function ($arg1) { |
|
19 | + $route->set(null, null, "search/{arg1}", function($arg1) { |
|
20 | 20 | return $arg1; |
21 | 21 | }); |
22 | 22 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $route = new Route(); |
39 | 39 | |
40 | - $route->set(null, null, "search/{arg1}/{arg2}", function ($arg1, $arg2) { |
|
40 | + $route->set(null, null, "search/{arg1}/{arg2}", function($arg1, $arg2) { |
|
41 | 41 | return "$arg1$arg2"; |
42 | 42 | }); |
43 | 43 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $route = new Route(); |
60 | 60 | |
61 | - $route->set(null, null, "search/{arg1}/what/{arg2}", function ($arg1, $arg2) { |
|
61 | + $route->set(null, null, "search/{arg1}/what/{arg2}", function($arg1, $arg2) { |
|
62 | 62 | return "$arg1$arg2"; |
63 | 63 | }); |
64 | 64 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $router = new Router(); |
37 | 37 | |
38 | - $router->any(null, "about", function () { |
|
38 | + $router->any(null, "about", function() { |
|
39 | 39 | return "about"; |
40 | 40 | }); |
41 | 41 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $router = new Router(); |
59 | 59 | |
60 | - $router->add("about", function () { |
|
60 | + $router->add("about", function() { |
|
61 | 61 | return "about"; |
62 | 62 | }); |
63 | 63 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $router = new Router(); |
81 | 81 | |
82 | - $router->always(function () { |
|
82 | + $router->always(function() { |
|
83 | 83 | return "always"; |
84 | 84 | }); |
85 | 85 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $router = new Router(); |
110 | 110 | |
111 | - $router->all($method, function () use ($method) { |
|
111 | + $router->all($method, function() use ($method) { |
|
112 | 112 | return "all-$method"; |
113 | 113 | }); |
114 | 114 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | { |
155 | 155 | $router = new Router(); |
156 | 156 | |
157 | - $router->get("", function () { |
|
157 | + $router->get("", function() { |
|
158 | 158 | return "get"; |
159 | 159 | }); |
160 | 160 | |
161 | - $router->always(function () { |
|
161 | + $router->always(function() { |
|
162 | 162 | return "not get"; |
163 | 163 | }); |
164 | 164 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | { |
186 | 186 | $router = new Router(); |
187 | 187 | |
188 | - $router->post("", function () { |
|
188 | + $router->post("", function() { |
|
189 | 189 | return "post"; |
190 | 190 | }); |
191 | 191 | |
192 | - $router->always(function () { |
|
192 | + $router->always(function() { |
|
193 | 193 | return "not post"; |
194 | 194 | }); |
195 | 195 | |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | { |
217 | 217 | $router = new Router(); |
218 | 218 | |
219 | - $router->put("", function () { |
|
219 | + $router->put("", function() { |
|
220 | 220 | return "put"; |
221 | 221 | }); |
222 | 222 | |
223 | - $router->always(function () { |
|
223 | + $router->always(function() { |
|
224 | 224 | return "not put"; |
225 | 225 | }); |
226 | 226 | |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | { |
248 | 248 | $router = new Router(); |
249 | 249 | |
250 | - $router->patch("", function () { |
|
250 | + $router->patch("", function() { |
|
251 | 251 | return "patch"; |
252 | 252 | }); |
253 | 253 | |
254 | - $router->always(function () { |
|
254 | + $router->always(function() { |
|
255 | 255 | return "not patch"; |
256 | 256 | }); |
257 | 257 | |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | { |
279 | 279 | $router = new Router(); |
280 | 280 | |
281 | - $router->delete("", function () { |
|
281 | + $router->delete("", function() { |
|
282 | 282 | return "delete"; |
283 | 283 | }); |
284 | 284 | |
285 | - $router->always(function () { |
|
285 | + $router->always(function() { |
|
286 | 286 | return "not delete"; |
287 | 287 | }); |
288 | 288 | |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | { |
310 | 310 | $router = new Router(); |
311 | 311 | |
312 | - $router->options("", function () { |
|
312 | + $router->options("", function() { |
|
313 | 313 | return "options"; |
314 | 314 | }); |
315 | 315 | |
316 | - $router->always(function () { |
|
316 | + $router->always(function() { |
|
317 | 317 | return "not options"; |
318 | 318 | }); |
319 | 319 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | { |
339 | 339 | $router = new Router(); |
340 | 340 | |
341 | - $router->add(["", "about"], function () { |
|
341 | + $router->add(["", "about"], function() { |
|
342 | 342 | return "yes"; |
343 | 343 | }); |
344 | 344 | |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | { |
370 | 370 | $router = new Router(); |
371 | 371 | |
372 | - $router->any(["GET", "POST"], "user", function () { |
|
372 | + $router->any(["GET", "POST"], "user", function() { |
|
373 | 373 | return "user"; |
374 | 374 | }); |
375 | 375 | |
376 | - $router->always(function () { |
|
376 | + $router->always(function() { |
|
377 | 377 | return "always"; |
378 | 378 | }); |
379 | 379 |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | { |
98 | 98 | $router = new Router(); |
99 | 99 | |
100 | - $router->addInternalRoute("404", function () { |
|
100 | + $router->addInternalRoute("404", function() { |
|
101 | 101 | echo "404 "; |
102 | 102 | }); |
103 | 103 | |
104 | - $router->add("about", function () { |
|
104 | + $router->add("about", function() { |
|
105 | 105 | echo "about "; |
106 | 106 | }); |
107 | 107 | |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | { |
124 | 124 | $router = new Router(); |
125 | 125 | |
126 | - $router->addInternalRoute("403", function () { |
|
126 | + $router->addInternalRoute("403", function() { |
|
127 | 127 | echo "403 "; |
128 | 128 | }); |
129 | 129 | |
130 | - $router->add("login", function () { |
|
130 | + $router->add("login", function() { |
|
131 | 131 | throw new ForbiddenException(); |
132 | 132 | }); |
133 | 133 | |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | { |
150 | 150 | $router = new Router(); |
151 | 151 | |
152 | - $router->addInternalRoute("500", function () { |
|
152 | + $router->addInternalRoute("500", function() { |
|
153 | 153 | echo "500 "; |
154 | 154 | }); |
155 | 155 | |
156 | - $router->add("calculate", function () { |
|
156 | + $router->add("calculate", function() { |
|
157 | 157 | throw new InternalErrorException(); |
158 | 158 | }); |
159 | 159 |