@@ -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 | }); |
@@ -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 |
@@ -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 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getConfigPath() |
103 | 103 | { |
104 | - return $this->getPath() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config'; |
|
104 | + return $this->getPath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | $container->add('app', $this); |
131 | 131 | $container->add('registry', $container); |
132 | 132 | |
133 | - $container->add('config', function () { |
|
133 | + $container->add('config', function() { |
|
134 | 134 | return new Config($this->getConfigPath(), 'prod'); |
135 | 135 | }); |
136 | 136 | |
137 | 137 | $this->config = $container->make('config'); |
138 | 138 | |
139 | - $container->add('routes', function () { |
|
139 | + $container->add('routes', function() { |
|
140 | 140 | return new Collection(); |
141 | 141 | }); |
142 | 142 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function registerServices() |
167 | 167 | { |
168 | - $services = array_filter($this->config->get('app.services'), function ($service) { |
|
168 | + $services = array_filter($this->config->get('app.services'), function($service) { |
|
169 | 169 | return class_exists($service); |
170 | 170 | }); |
171 | 171 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | protected function loadRoutes() |
198 | 198 | { |
199 | 199 | $router = $this->container->make('routes'); |
200 | - $routes = realpath($this->getPath() . '/app/routes.php'); |
|
200 | + $routes = realpath($this->getPath().'/app/routes.php'); |
|
201 | 201 | |
202 | 202 | if (file_exists($routes)) { |
203 | 203 | require $routes; |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | public function send() |
74 | 74 | { |
75 | 75 | foreach ($this->headers as $key => $value) { |
76 | - header("$key: " . implode(',', $value)); |
|
76 | + header("$key: ".implode(',', $value)); |
|
77 | 77 | } |
78 | 78 | |
79 | - if($this->hasHeader('Content-Type') === false) { |
|
79 | + if ($this->hasHeader('Content-Type') === false) { |
|
80 | 80 | header(vsprintf( |
81 | 81 | 'Content-Type: %s', |
82 | 82 | $this->hasHeader('Content-Type') ? $this->getHeader('Content-Type') : [$this->contentType] |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($this->compression) { |
90 | 90 | ob_start('ob_gzhandler'); |
91 | 91 | } |
92 | - echo (string)$this->getBody(); |
|
92 | + echo (string) $this->getBody(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | ob_end_flush(); |
@@ -100,6 +100,6 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function __toString() |
102 | 102 | { |
103 | - return (string)$this->getBody(); |
|
103 | + return (string) $this->getBody(); |
|
104 | 104 | } |
105 | 105 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function locate($key, $member) |
126 | 126 | { |
127 | - $aliases = array_filter($this->members, function ($n) use ($member) { |
|
127 | + $aliases = array_filter($this->members, function($n) use ($member) { |
|
128 | 128 | if ($n instanceof Closure) { |
129 | 129 | return $n($this) instanceof $member; |
130 | 130 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function getParams() |
149 | 149 | { |
150 | - return function (ReflectionParameter $param) { |
|
150 | + return function(ReflectionParameter $param) { |
|
151 | 151 | return $param->getClass(); |
152 | 152 | }; |
153 | 153 | } |
@@ -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 . '://' : '') |
|
305 | + return ($scheme ? $scheme.'://' : '') |
|
306 | 306 | . ($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 |
@@ -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 ($code < 100 || $code >= 600) { |
113 | 113 | throw new \InvalidArgumentException(sprintf('Invalid status code %d', $code)); |
114 | 114 | } |
@@ -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 (string) $param->getType(); |
106 | 106 | }; |
107 | 107 | } |