@@ -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!'); |
@@ -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 | } |
@@ -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 |
@@ -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 | ); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @return callable |
| 173 | 173 | */ |
| 174 | - $container['notFoundHandler'] = function () { |
|
| 174 | + $container['notFoundHandler'] = function() { |
|
| 175 | 175 | return new NotFound; |
| 176 | 176 | }; |
| 177 | 177 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return callable |
| 192 | 192 | */ |
| 193 | - $container['notAllowedHandler'] = function () { |
|
| 193 | + $container['notAllowedHandler'] = function() { |
|
| 194 | 194 | return new NotAllowed; |
| 195 | 195 | }; |
| 196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return CallableResolverInterface |
| 205 | 205 | */ |
| 206 | - $container['callableResolver'] = function ($container) { |
|
| 206 | + $container['callableResolver'] = function($container) { |
|
| 207 | 207 | return new CallableResolver($container); |
| 208 | 208 | }; |
| 209 | 209 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->headers->set('Host', $this->uri->getHost() . $port); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $this->registerMediaTypeParser('application/json', function ($input) { |
|
| 206 | + $this->registerMediaTypeParser('application/json', function($input) { |
|
| 207 | 207 | $result = json_decode($input, true); |
| 208 | 208 | if (!is_array($result)) { |
| 209 | 209 | return null; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | return $result; |
| 212 | 212 | }); |
| 213 | 213 | |
| 214 | - $this->registerMediaTypeParser('application/xml', function ($input) { |
|
| 214 | + $this->registerMediaTypeParser('application/xml', function($input) { |
|
| 215 | 215 | $backup = libxml_disable_entity_loader(true); |
| 216 | 216 | $backup_errors = libxml_use_internal_errors(true); |
| 217 | 217 | $result = simplexml_load_string($input); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | return $result; |
| 225 | 225 | }); |
| 226 | 226 | |
| 227 | - $this->registerMediaTypeParser('text/xml', function ($input) { |
|
| 227 | + $this->registerMediaTypeParser('text/xml', function($input) { |
|
| 228 | 228 | $backup = libxml_disable_entity_loader(true); |
| 229 | 229 | $backup_errors = libxml_use_internal_errors(true); |
| 230 | 230 | $result = simplexml_load_string($input); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | return $result; |
| 238 | 238 | }); |
| 239 | 239 | |
| 240 | - $this->registerMediaTypeParser('application/x-www-form-urlencoded', function ($input) { |
|
| 240 | + $this->registerMediaTypeParser('application/x-www-form-urlencoded', function($input) { |
|
| 241 | 241 | parse_str($input, $data); |
| 242 | 242 | return $data; |
| 243 | 243 | }); |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | // look for a media type with a structured syntax suffix (RFC 6839) |
| 1034 | 1034 | $parts = explode('+', $mediaType); |
| 1035 | 1035 | if (count($parts) >= 2) { |
| 1036 | - $mediaType = 'application/' . $parts[count($parts)-1]; |
|
| 1036 | + $mediaType = 'application/' . $parts[count($parts) - 1]; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | if (isset($this->bodyParsers[$mediaType]) === true) { |