@@ -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 | |
@@ -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 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->headers->set('Host', $this->uri->getHost()); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $this->registerMediaTypeParser('application/json', function ($input) { |
|
| 204 | + $this->registerMediaTypeParser('application/json', function($input) { |
|
| 205 | 205 | $result = json_decode($input, true); |
| 206 | 206 | if (!is_array($result)) { |
| 207 | 207 | return null; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | return $result; |
| 210 | 210 | }); |
| 211 | 211 | |
| 212 | - $this->registerMediaTypeParser('application/xml', function ($input) { |
|
| 212 | + $this->registerMediaTypeParser('application/xml', function($input) { |
|
| 213 | 213 | $backup = libxml_disable_entity_loader(true); |
| 214 | 214 | $backup_errors = libxml_use_internal_errors(true); |
| 215 | 215 | $result = simplexml_load_string($input); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | return $result; |
| 223 | 223 | }); |
| 224 | 224 | |
| 225 | - $this->registerMediaTypeParser('text/xml', function ($input) { |
|
| 225 | + $this->registerMediaTypeParser('text/xml', function($input) { |
|
| 226 | 226 | $backup = libxml_disable_entity_loader(true); |
| 227 | 227 | $backup_errors = libxml_use_internal_errors(true); |
| 228 | 228 | $result = simplexml_load_string($input); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | return $result; |
| 236 | 236 | }); |
| 237 | 237 | |
| 238 | - $this->registerMediaTypeParser('application/x-www-form-urlencoded', function ($input) { |
|
| 238 | + $this->registerMediaTypeParser('application/x-www-form-urlencoded', function($input) { |
|
| 239 | 239 | parse_str($input, $data); |
| 240 | 240 | return $data; |
| 241 | 241 | }); |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | // look for a media type with a structured syntax suffix (RFC 6839) |
| 1032 | 1032 | $parts = explode('+', $mediaType); |
| 1033 | 1033 | if (count($parts) >= 2) { |
| 1034 | - $mediaType = 'application/' . $parts[count($parts)-1]; |
|
| 1034 | + $mediaType = 'application/' . $parts[count($parts) - 1]; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | if (isset($this->bodyParsers[$mediaType]) === true) { |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct($displayErrorDetails = false, $outputBuffering = false) |
| 32 | 32 | { |
| 33 | - $this->displayErrorDetails = (bool) $displayErrorDetails; |
|
| 33 | + $this->displayErrorDetails = (bool)$displayErrorDetails; |
|
| 34 | 34 | $this->outputBuffering = $outputBuffering; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return EnvironmentInterface |
| 45 | 45 | */ |
| 46 | - $container['environment'] = function () { |
|
| 46 | + $container['environment'] = function() { |
|
| 47 | 47 | return new Environment($_SERVER); |
| 48 | 48 | }; |
| 49 | 49 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return ServerRequestInterface |
| 58 | 58 | */ |
| 59 | - $container['request'] = function ($container) { |
|
| 59 | + $container['request'] = function($container) { |
|
| 60 | 60 | return Request::createFromEnvironment($container->get('environment')); |
| 61 | 61 | }; |
| 62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return ResponseInterface |
| 71 | 71 | */ |
| 72 | - $container['response'] = function ($container) { |
|
| 72 | + $container['response'] = function($container) { |
|
| 73 | 73 | $headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']); |
| 74 | 74 | $response = new Response(200, $headers); |
| 75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return RouterInterface |
| 88 | 88 | */ |
| 89 | - $container['router'] = function ($container) { |
|
| 89 | + $container['router'] = function($container) { |
|
| 90 | 90 | $routerCacheFile = false; |
| 91 | 91 | if (isset($container->get('settings')['routerCacheFile'])) { |
| 92 | 92 | $routerCacheFile = $container->get('settings')['routerCacheFile']; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return InvocationStrategyInterface |
| 111 | 111 | */ |
| 112 | - $container['foundHandler'] = function () { |
|
| 112 | + $container['foundHandler'] = function() { |
|
| 113 | 113 | return new RequestResponse; |
| 114 | 114 | }; |
| 115 | 115 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return callable |
| 132 | 132 | */ |
| 133 | - $container['phpErrorHandler'] = function ($container) { |
|
| 133 | + $container['phpErrorHandler'] = function($container) { |
|
| 134 | 134 | return new PhpError($container->get('settings')['displayErrorDetails']); |
| 135 | 135 | }; |
| 136 | 136 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @return callable |
| 153 | 153 | */ |
| 154 | - $container['errorHandler'] = function ($container) { |
|
| 154 | + $container['errorHandler'] = function($container) { |
|
| 155 | 155 | return new Error( |
| 156 | 156 | $container->get('settings')['displayErrorDetails'], |
| 157 | 157 | $container->get('settings')['outputBuffering'] |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return callable |
| 174 | 174 | */ |
| 175 | - $container['notFoundHandler'] = function () { |
|
| 175 | + $container['notFoundHandler'] = function() { |
|
| 176 | 176 | return new NotFound; |
| 177 | 177 | }; |
| 178 | 178 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @return callable |
| 193 | 193 | */ |
| 194 | - $container['notAllowedHandler'] = function () { |
|
| 194 | + $container['notAllowedHandler'] = function() { |
|
| 195 | 195 | return new NotAllowed; |
| 196 | 196 | }; |
| 197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return CallableResolverInterface |
| 206 | 206 | */ |
| 207 | - $container['callableResolver'] = function ($container) { |
|
| 207 | + $container['callableResolver'] = function($container) { |
|
| 208 | 208 | return new CallableResolver($container); |
| 209 | 209 | }; |
| 210 | 210 | } |