@@ -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 | /** |
@@ -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 ( |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function redirect($from, $to, $status = 302) |
| 261 | 261 | { |
| 262 | - $handler = function ($request, ResponseInterface $response) use ($to, $status) { |
|
| 262 | + $handler = function($request, ResponseInterface $response) use ($to, $status) { |
|
| 263 | 263 | return $response->withHeader('Location', (string)$to)->withStatus($status); |
| 264 | 264 | }; |
| 265 | 265 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | $router = $this->container->get('router'); |
| 504 | 504 | |
| 505 | 505 | // If router hasn't been dispatched or the URI changed then dispatch |
| 506 | - if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string) $request->getUri()])) { |
|
| 506 | + if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string)$request->getUri()])) { |
|
| 507 | 507 | $request = $this->dispatchRouterAndPrepareRoute($request, $router); |
| 508 | 508 | $routeInfo = $request->getAttribute('routeInfo'); |
| 509 | 509 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | $request = $request->withAttribute('route', $route); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()]; |
|
| 598 | + $routeInfo['request'] = [$request->getMethod(), (string)$request->getUri()]; |
|
| 599 | 599 | |
| 600 | 600 | return $request->withAttribute('routeInfo', $routeInfo); |
| 601 | 601 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | } |
| 625 | 625 | $size = $response->getBody()->getSize(); |
| 626 | 626 | if ($size !== null && !$response->hasHeader('Content-Length')) { |
| 627 | - $response = $response->withHeader('Content-Length', (string) $size); |
|
| 627 | + $response = $response->withHeader('Content-Length', (string)$size); |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | |
@@ -222,8 +222,8 @@ |
||
| 222 | 222 | protected function filterStatus($status) |
| 223 | 223 | { |
| 224 | 224 | if (!is_integer($status) || |
| 225 | - $status<StatusCode::HTTP_CONTINUE || |
|
| 226 | - $status>StatusCode::HTTP_NETWORK_CONNECTION_TIMEOUT_ERROR |
|
| 225 | + $status < StatusCode::HTTP_CONTINUE || |
|
| 226 | + $status > StatusCode::HTTP_NETWORK_CONNECTION_TIMEOUT_ERROR |
|
| 227 | 227 | ) { |
| 228 | 228 | throw new InvalidArgumentException('Invalid HTTP status code'); |
| 229 | 229 | } |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | const HTTP_SEE_OTHER = 303; |
| 32 | 32 | const HTTP_NOT_MODIFIED = 304; |
| 33 | 33 | const HTTP_USE_PROXY = 305; |
| 34 | - const HTTP_UNUSED= 306; |
|
| 34 | + const HTTP_UNUSED = 306; |
|
| 35 | 35 | const HTTP_TEMPORARY_REDIRECT = 307; |
| 36 | 36 | const HTTP_PERMANENT_REDIRECT = 308; |
| 37 | 37 | |
| 38 | 38 | const HTTP_BAD_REQUEST = 400; |
| 39 | - const HTTP_UNAUTHORIZED = 401; |
|
| 39 | + const HTTP_UNAUTHORIZED = 401; |
|
| 40 | 40 | const HTTP_PAYMENT_REQUIRED = 402; |
| 41 | 41 | const HTTP_FORBIDDEN = 403; |
| 42 | 42 | const HTTP_NOT_FOUND = 404; |
@@ -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 | }); |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // If not, look for a media type with a structured syntax suffix (RFC 6839) |
| 1036 | 1036 | $parts = explode('+', $mediaType); |
| 1037 | 1037 | if (count($parts) >= 2) { |
| 1038 | - $mediaType = 'application/' . $parts[count($parts)-1]; |
|
| 1038 | + $mediaType = 'application/' . $parts[count($parts) - 1]; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | } |
| 1041 | 1041 | |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | if (is_array($env['slim.files']) && $env->has('slim.files')) { |
| 87 | 87 | return $env['slim.files']; |
| 88 | - } elseif (! empty($_FILES)) { |
|
| 88 | + } elseif (!empty($_FILES)) { |
|
| 89 | 89 | return static::parseUploadedFiles($_FILES); |
| 90 | 90 | } |
| 91 | 91 | |