@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function middleware(array $stack): array |
46 | 46 | { |
47 | - return array_map(function ($callable) { |
|
47 | + return array_map(function($callable) { |
|
48 | 48 | $callable = is_string($callable) ? static::lazy($callable) : $callable; |
49 | 49 | return $callable; |
50 | 50 | }, $stack); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function lazy(string $className): callable |
61 | 61 | { |
62 | - return function (ServerRequestInterface $request, RequestHandlerInterface $handler) use ($className): ResponseInterface { |
|
62 | + return function(ServerRequestInterface $request, RequestHandlerInterface $handler) use ($className): ResponseInterface { |
|
63 | 63 | $class = new $className(); |
64 | 64 | if ($class instanceof MiddlewareInterface) { |
65 | 65 | return $class->process($request, $handler); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public static function router(ServerRequestInterface $request, string $path = null): ResponseInterface |
80 | 80 | { |
81 | 81 | $path = $path ?: __DIR__ . "/../app/routes.php"; |
82 | - $dispatcher = \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($path) { |
|
82 | + $dispatcher = \FastRoute\simpleDispatcher(function(RouteCollector $r) use ($path) { |
|
83 | 83 | include $path; |
84 | 84 | }); |
85 | 85 | $match = $dispatcher->dispatch($request->getMethod(), $request->getUri()->getPath()); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param string $view name of the view to load |
19 | 19 | * @param array $data data to expose to the view |
20 | 20 | * @param Engine $engine alternative rendering engine |
21 | - * @return Psr\Http\Message\ResponseInterface |
|
21 | + * @return ResponseInterface |
|
22 | 22 | */ |
23 | 23 | public static function view(string $view, array $data, Engine $engine = null): ResponseInterface |
24 | 24 | { |
@@ -28,9 +28,8 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Returns a response with a particular view loaded. |
30 | 30 | * |
31 | - * @param mixed $json JSON serializable data |
|
32 | 31 | * @param int $flags JSON flags |
33 | - * @return Psr\Http\Message\ResponseInterface |
|
32 | + * @return ResponseInterface |
|
34 | 33 | */ |
35 | 34 | public static function json($data, int $flags = 79): ResponseInterface |
36 | 35 | { |
@@ -41,7 +40,7 @@ discard block |
||
41 | 40 | * Create a new basic string response. |
42 | 41 | * |
43 | 42 | * @param string $string string to respond |
44 | - * @return Psr\Http\Message\ResponseInterface |
|
43 | + * @return ResponseInterface |
|
45 | 44 | */ |
46 | 45 | public static function string(string $string): ResponseInterface |
47 | 46 | { |
@@ -51,7 +50,7 @@ discard block |
||
51 | 50 | /** |
52 | 51 | * Respond with a 400 bad request error json message. |
53 | 52 | * |
54 | - * @return Psr\Http\Message\ResponseInterface |
|
53 | + * @return ResponseInterface |
|
55 | 54 | */ |
56 | 55 | public static function error400(ServerRequestInterface $request): ResponseInterface |
57 | 56 | { |
@@ -61,7 +60,7 @@ discard block |
||
61 | 60 | /** |
62 | 61 | * Respond with a 403 error message. |
63 | 62 | * |
64 | - * @return Psr\Http\Message\ResponseInterface |
|
63 | + * @return ResponseInterface |
|
65 | 64 | */ |
66 | 65 | public static function error403(ServerRequestInterface $request): ResponseInterface |
67 | 66 | { |
@@ -71,7 +70,7 @@ discard block |
||
71 | 70 | /** |
72 | 71 | * Respond with a 404 error message. |
73 | 72 | * |
74 | - * @return Psr\Http\Message\ResponseInterface |
|
73 | + * @return ResponseInterface |
|
75 | 74 | */ |
76 | 75 | public static function error404(ServerRequestInterface $request): ResponseInterface |
77 | 76 | { |
@@ -81,7 +80,7 @@ discard block |
||
81 | 80 | /** |
82 | 81 | * Respond with a 405 error message. |
83 | 82 | * |
84 | - * @return Psr\Http\Message\ResponseInterface |
|
83 | + * @return ResponseInterface |
|
85 | 84 | */ |
86 | 85 | public static function error405(ServerRequestInterface $request): ResponseInterface |
87 | 86 | { |
@@ -91,7 +90,7 @@ discard block |
||
91 | 90 | /** |
92 | 91 | * Respond with a 429 error message. |
93 | 92 | * |
94 | - * @return Psr\Http\Message\ResponseInterface |
|
93 | + * @return ResponseInterface |
|
95 | 94 | */ |
96 | 95 | public static function error429(ServerRequestInterface $request): ResponseInterface |
97 | 96 | { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Relay\Relay; |
4 | 4 | use Fermi\Framework; |
5 | -use Zend\Diactoros\ServerRequestFactory; |
|
6 | 5 | |
7 | 6 | /** |
8 | 7 | * Fermi - A nuclear sized PSR-7 and PSR-15 compliant PHP framework. |