@@ -26,12 +26,12 @@ |
||
26 | 26 | * argument for `Slim::get`, `Slim::post`, `Slim::put`, `Slim::patch`, and `Slim::delete` |
27 | 27 | * is an anonymous function. |
28 | 28 | */ |
29 | -$app->get('/', function ($request, $response, $args) { |
|
29 | +$app->get('/', function($request, $response, $args) { |
|
30 | 30 | $response->write("Welcome to Slim!"); |
31 | 31 | return $response; |
32 | 32 | }); |
33 | 33 | |
34 | -$app->get('/hello[/{name}]', function ($request, $response, $args) { |
|
34 | +$app->get('/hello[/{name}]', function($request, $response, $args) { |
|
35 | 35 | $response->write("Hello, " . $args['name']); |
36 | 36 | return $response; |
37 | 37 | })->setArgument('name', 'World!'); |
@@ -207,7 +207,7 @@ |
||
207 | 207 | */ |
208 | 208 | protected function filterStatus($status) |
209 | 209 | { |
210 | - if (!is_integer($status) || $status<100 || $status>599) { |
|
210 | + if (!is_integer($status) || $status < 100 || $status > 599) { |
|
211 | 211 | throw new InvalidArgumentException('Invalid HTTP status code'); |
212 | 212 | } |
213 | 213 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $key = strtoupper($key); |
57 | 57 | if (isset(static::$special[$key]) || strpos($key, 'HTTP_') === 0) { |
58 | 58 | if ($key !== 'HTTP_CONTENT_LENGTH') { |
59 | - $data[$key] = $value; |
|
59 | + $data[$key] = $value; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $router = $this->container->get('router'); |
434 | 434 | |
435 | 435 | // If router hasn't been dispatched or the URI changed then dispatch |
436 | - if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string) $request->getUri()])) { |
|
436 | + if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string)$request->getUri()])) { |
|
437 | 437 | $request = $this->dispatchRouterAndPrepareRoute($request, $router); |
438 | 438 | $routeInfo = $request->getAttribute('routeInfo'); |
439 | 439 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $request = $request->withAttribute('route', $route); |
526 | 526 | } |
527 | 527 | |
528 | - $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()]; |
|
528 | + $routeInfo['request'] = [$request->getMethod(), (string)$request->getUri()]; |
|
529 | 529 | |
530 | 530 | return $request->withAttribute('routeInfo', $routeInfo); |
531 | 531 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | } |
555 | 555 | $size = $response->getBody()->getSize(); |
556 | 556 | if ($size !== null && !$response->hasHeader('Content-Length')) { |
557 | - $response = $response->withHeader('Content-Length', (string) $size); |
|
557 | + $response = $response->withHeader('Content-Length', (string)$size); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 |
@@ -14,7 +14,6 @@ discard block |
||
14 | 14 | use Throwable; |
15 | 15 | use Closure; |
16 | 16 | use InvalidArgumentException; |
17 | -use Psr\Http\Message\RequestInterface; |
|
18 | 17 | use Psr\Http\Message\ServerRequestInterface; |
19 | 18 | use Psr\Http\Message\ResponseInterface; |
20 | 19 | use Psr\Container\ContainerInterface; |
@@ -26,7 +25,6 @@ discard block |
||
26 | 25 | use Slim\Http\Headers; |
27 | 26 | use Slim\Http\Body; |
28 | 27 | use Slim\Http\Request; |
29 | -use Slim\Interfaces\Http\EnvironmentInterface; |
|
30 | 28 | use Slim\Interfaces\RouteGroupInterface; |
31 | 29 | use Slim\Interfaces\RouteInterface; |
32 | 30 | use Slim\Interfaces\RouterInterface; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function __construct($displayErrorDetails = false) |
27 | 27 | { |
28 | - $this->displayErrorDetails = (bool) $displayErrorDetails; |
|
28 | + $this->displayErrorDetails = (bool)$displayErrorDetails; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * |
95 | 95 | * @return array|\ArrayAccess |
96 | 96 | */ |
97 | - $this['settings'] = function () use ($userSettings, $defaultSettings) { |
|
97 | + $this['settings'] = function() use ($userSettings, $defaultSettings) { |
|
98 | 98 | return new Collection(array_merge($defaultSettings, $userSettings)); |
99 | 99 | }; |
100 | 100 |
@@ -188,7 +188,7 @@ |
||
188 | 188 | return $this->dispatcher; |
189 | 189 | } |
190 | 190 | |
191 | - $routeDefinitionCallback = function (RouteCollector $r) { |
|
191 | + $routeDefinitionCallback = function(RouteCollector $r) { |
|
192 | 192 | foreach ($this->getRoutes() as $route) { |
193 | 193 | $r->addRoute($route->getMethods(), $route->getPattern(), $route->getIdentifier()); |
194 | 194 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $this->seedMiddlewareStack(); |
61 | 61 | } |
62 | 62 | $next = $this->tip; |
63 | - $this->tip = function ( |
|
63 | + $this->tip = function( |
|
64 | 64 | ServerRequestInterface $request, |
65 | 65 | ResponseInterface $response |
66 | 66 | ) use ( |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | $host = $matches[1]; |
187 | 187 | |
188 | 188 | if (isset($matches[2])) { |
189 | - $port = (int) substr($matches[2], 1); |
|
189 | + $port = (int)substr($matches[2], 1); |
|
190 | 190 | } |
191 | 191 | } else { |
192 | 192 | $pos = strpos($host, ':'); |
193 | 193 | if ($pos !== false) { |
194 | - $port = (int) substr($host, $pos + 1); |
|
194 | + $port = (int)substr($host, $pos + 1); |
|
195 | 195 | $host = strstr($host, ':', true); |
196 | 196 | } |
197 | 197 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | { |
397 | 397 | return preg_replace_callback( |
398 | 398 | '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', |
399 | - function ($match) { |
|
399 | + function($match) { |
|
400 | 400 | return rawurlencode($match[0]); |
401 | 401 | }, |
402 | 402 | $query |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | { |
642 | 642 | return preg_replace_callback( |
643 | 643 | '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', |
644 | - function ($match) { |
|
644 | + function($match) { |
|
645 | 645 | return rawurlencode($match[0]); |
646 | 646 | }, |
647 | 647 | $path |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | { |
715 | 715 | return preg_replace_callback( |
716 | 716 | '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', |
717 | - function ($match) { |
|
717 | + function($match) { |
|
718 | 718 | return rawurlencode($match[0]); |
719 | 719 | }, |
720 | 720 | $query |