@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | if ($config['log_errors'] === true) { |
| 17 | 17 | |
| 18 | - $this->registry->add('logger', function () use ($config) { |
|
| 18 | + $this->registry->add('logger', function() use ($config) { |
|
| 19 | 19 | return new BaseLogger($config['log_prefix']); |
| 20 | 20 | }); |
| 21 | 21 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | $route = preg_replace('/{([a-z0-9_-]+)}/i', '(?P<$1>[^/]+)', $route); |
| 65 | 65 | |
| 66 | - if(substr($route, -1) === '/') { |
|
| 66 | + if (substr($route, -1) === '/') { |
|
| 67 | 67 | $route .= '?'; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | public function withStatus($code, $reasonPhrase = '') |
| 109 | 109 | { |
| 110 | 110 | $instance = clone $this; |
| 111 | - $code = (int)$code; |
|
| 111 | + $code = (int) $code; |
|
| 112 | 112 | if (is_float($code) || $code < 100 || $code >= 600) { |
| 113 | 113 | throw new \InvalidArgumentException(sprintf('Invalid status code %d', $code)); |
| 114 | 114 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | 'REMOTE_ADDR' => '127.0.0.1', |
| 65 | 65 | 'SERVER_PROTOCOL' => 'HTTP/1.1', |
| 66 | 66 | 'REQUEST_TIME' => time(), |
| 67 | - 'REQUEST_URI' => (string)$uri, |
|
| 67 | + 'REQUEST_URI' => (string) $uri, |
|
| 68 | 68 | 'REQUEST_METHOD' => $method |
| 69 | 69 | ], $_SERVER); |
| 70 | 70 | |
@@ -39,8 +39,6 @@ |
||
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * ServerRequest constructor. |
| 42 | - * @param string $uri |
|
| 43 | - * @param string $method |
|
| 44 | 42 | * @param array $server |
| 45 | 43 | */ |
| 46 | 44 | public function __construct($server = []) |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace Fyuze\Http\Message; |
| 3 | 3 | |
| 4 | 4 | use Psr\Http\Message\ServerRequestInterface; |
| 5 | -use Psr\Http\Message\UriInterface; |
|
| 6 | 5 | |
| 7 | 6 | class ServerRequest extends Request implements ServerRequestInterface |
| 8 | 7 | { |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | protected function match(ServerRequestInterface $request) |
| 43 | 43 | { |
| 44 | - return array_filter($this->routes->getRoutes(), function (Route $route) use ($request) { |
|
| 44 | + return array_filter($this->routes->getRoutes(), function(Route $route) use ($request) { |
|
| 45 | 45 | $match = $route->matches($request); |
| 46 | - if(false !== $match) { |
|
| 46 | + if (false !== $match) { |
|
| 47 | 47 | return $route->setParams($match); |
| 48 | 48 | } |
| 49 | 49 | }); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $route = $this->router->resolve($request); |
| 45 | 45 | |
| 46 | 46 | $response = $this->resolve($route->getAction(), $route->getQueryParams()); |
| 47 | - if(false === $response instanceof ResponseInterface) { |
|
| 47 | + if (false === $response instanceof ResponseInterface) { |
|
| 48 | 48 | $response = Response::create($response); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function getParams() |
| 103 | 103 | { |
| 104 | - return function (ReflectionParameter $param) { |
|
| 104 | + return function(ReflectionParameter $param) { |
|
| 105 | 105 | return $param->getClass(); |
| 106 | 106 | }; |
| 107 | 107 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $headers = []; |
| 64 | 64 | |
| 65 | - foreach($this->headers as $name => $values) { |
|
| 65 | + foreach ($this->headers as $name => $values) { |
|
| 66 | 66 | $headers[strtolower($name)] = $values; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $instance = clone $this; |
| 131 | - $instance->headers[$name] = array_filter((array)$value); |
|
| 131 | + $instance->headers[$name] = array_filter((array) $value); |
|
| 132 | 132 | return $instance; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | - * @param $key |
|
| 186 | + * @param string $key |
|
| 187 | 187 | * @param $value |
| 188 | 188 | * @return static |
| 189 | 189 | */ |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
| 313 | - * @param $uri |
|
| 313 | + * @param string $uri |
|
| 314 | 314 | */ |
| 315 | 315 | protected function format($uri) |
| 316 | 316 | { |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | - * @param $scheme |
|
| 375 | - * @param $port |
|
| 374 | + * @param string $scheme |
|
| 375 | + * @param integer $port |
|
| 376 | 376 | * @return bool |
| 377 | 377 | */ |
| 378 | 378 | protected function isStandardPort($scheme, $port) |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | - * @param $key |
|
| 394 | + * @param string $key |
|
| 395 | 395 | * @param $value |
| 396 | 396 | * @return static |
| 397 | 397 | */ |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $userInfo = $this->getUserInfo(); |
| 105 | 105 | |
| 106 | - return rtrim(($userInfo ? $userInfo . '@' : '') |
|
| 106 | + return rtrim(($userInfo ? $userInfo.'@' : '') |
|
| 107 | 107 | . $this->host |
| 108 | - . (!$this->isStandardPort($this->scheme, $this->port) ? ':' . $this->port : ''), |
|
| 108 | + . (!$this->isStandardPort($this->scheme, $this->port) ? ':'.$this->port : ''), |
|
| 109 | 109 | ':'); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function withScheme($scheme) |
| 188 | 188 | { |
| 189 | - $scheme = str_replace('://', '', strtolower((string)$scheme)); |
|
| 189 | + $scheme = str_replace('://', '', strtolower((string) $scheme)); |
|
| 190 | 190 | |
| 191 | 191 | if (!empty($scheme) && !array_key_exists($scheme, $this->schemes)) { |
| 192 | 192 | throw new InvalidArgumentException('Invalid scheme provided.'); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | throw new InvalidArgumentException('Invalid port specified'); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - return $this->_clone('port', (int)$port); |
|
| 241 | + return $this->_clone('port', (int) $port); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | if (!empty($path) && '/' !== substr($path, 0, 1)) { |
| 258 | - $path = '/' . $path; |
|
| 258 | + $path = '/'.$path; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return $this->_clone('path', $this->filterPath($path)); |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | $query = $this->getQuery(); |
| 303 | 303 | $fragment = $this->getFragment(); |
| 304 | 304 | |
| 305 | - return ($scheme ? $scheme . '://' : '') |
|
| 306 | - . ($authority ? '' . $authority : '') |
|
| 305 | + return ($scheme ? $scheme.'://' : '') |
|
| 306 | + . ($authority ? ''.$authority : '') |
|
| 307 | 307 | . $path |
| 308 | - . ($query ? '?' . $query : '') |
|
| 309 | - . ($fragment ? '#' . $fragment : ''); |
|
| 308 | + . ($query ? '?'.$query : '') |
|
| 309 | + . ($fragment ? '#'.$fragment : ''); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $this->$key = $val; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $this->userInfo = $this->user . ($this->pass ? ":$this->pass" : null); |
|
| 327 | + $this->userInfo = $this->user.($this->pass ? ":$this->pass" : null); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | throw new InvalidArgumentException(sprintf('The path you defined is not a valid directory: %s', $this->path)); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - foreach (new GlobIterator($this->path . '/*.*') as $file) { |
|
| 98 | + foreach (new GlobIterator($this->path.'/*.*') as $file) { |
|
| 99 | 99 | |
| 100 | - if($config = $this->getType($file)) { |
|
| 100 | + if ($config = $this->getType($file)) { |
|
| 101 | 101 | $this->configs[$config[0]] = $config[1]; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $extension = $file->getExtension(); |
| 113 | 113 | $name = $file->getBasename(".$extension"); |
| 114 | 114 | |
| 115 | - $type = array_filter($this->types, function ($n) use ($extension) { |
|
| 115 | + $type = array_filter($this->types, function($n) use ($extension) { |
|
| 116 | 116 | return in_array($extension, $n::$extensions); |
| 117 | 117 | }); |
| 118 | 118 | |