@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @var array |
88 | 88 | */ |
89 | - protected $middleware = []; |
|
89 | + protected $middleware = [ ]; |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Methods |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if (!is_string($callback)) { |
134 | 134 | if (!is_callable($callback)) { |
135 | 135 | throw new InvalidArgumentException( |
136 | - 'Expected a callable or string. Got an uncallable or not string'. gettype($callback) |
|
136 | + 'Expected a callable or string. Got an uncallable or not string'.gettype($callback) |
|
137 | 137 | ); |
138 | 138 | } |
139 | 139 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | // Allow null, otherwise expect an array or a string |
189 | 189 | if (null !== $method && !is_array($method) && !is_string($method)) { |
190 | - throw new InvalidArgumentException('Expected an array or string. Got a '. gettype($method)); |
|
190 | + throw new InvalidArgumentException('Expected an array or string. Got a '.gettype($method)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $this->method = $method; |
@@ -267,15 +267,15 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function middleware(string $name) |
269 | 269 | { |
270 | - $obj = $this->getFromConfig("middleware")[$name]; |
|
270 | + $obj = $this->getFromConfig("middleware")[ $name ]; |
|
271 | 271 | |
272 | 272 | if (is_null($obj)) { |
273 | - $obj = $this->getFromConfig("groups")[$name]; |
|
273 | + $obj = $this->getFromConfig("groups")[ $name ]; |
|
274 | 274 | |
275 | 275 | $this->doesMiddlewareExist($obj); |
276 | 276 | } |
277 | 277 | |
278 | - $this->middleware[$name] = $obj; |
|
278 | + $this->middleware[ $name ] = $obj; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -302,20 +302,20 @@ discard block |
||
302 | 302 | private function createInstances(array $middleware) |
303 | 303 | { |
304 | 304 | // to handle the case where no global middleware is configured |
305 | - if($middleware == []) { |
|
305 | + if ($middleware == [ ]) { |
|
306 | 306 | return; |
307 | 307 | } |
308 | 308 | |
309 | 309 | foreach ($middleware as $name => $class) { |
310 | 310 | if (is_array($class)) { |
311 | 311 | foreach ($class as $key => $value) { |
312 | - if($this->doesMiddlewareExist($value)) { |
|
313 | - $this->middleware[$name][$key] = new $value; |
|
312 | + if ($this->doesMiddlewareExist($value)) { |
|
313 | + $this->middleware[ $name ][ $key ] = new $value; |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } else { |
317 | - if($this->doesMiddlewareExist($class)) { |
|
318 | - $this->middleware[$name] = new $class; |
|
317 | + if ($this->doesMiddlewareExist($class)) { |
|
318 | + $this->middleware[ $name ] = new $class; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function doesMiddlewareExist($fullyQualifiedClassName):bool |
332 | 332 | { |
333 | - if(is_array($fullyQualifiedClassName)) { |
|
334 | - foreach($fullyQualifiedClassName as $className) { |
|
333 | + if (is_array($fullyQualifiedClassName)) { |
|
334 | + foreach ($fullyQualifiedClassName as $className) { |
|
335 | 335 | return $this->checkMiddlewareExists($className); |
336 | 336 | } |
337 | 337 | } else { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } else { |
354 | 354 | // if $fullyQualifiedClassName is object we dont throw an |
355 | 355 | // exception because middleware was already created. |
356 | - if (! is_object($className)) { |
|
356 | + if (!is_object($className)) { |
|
357 | 357 | throw new MiddlewareNotFoundException("Middleware `%s` not found", $className); |
358 | 358 | } |
359 | 359 |