@@ -177,7 +177,7 @@ |
||
177 | 177 | public function setRedirectMode($redirectMode) |
178 | 178 | { |
179 | 179 | $redirectMode = (int)$redirectMode; |
180 | - if ($redirectMode < 300 || $redirectMode >= 400) { |
|
180 | + if ($redirectMode < 300 || $redirectMode >= 400) { |
|
181 | 181 | throw new InvalidArgumentException( |
182 | 182 | 'Invalid HTTP status for redirect mode' |
183 | 183 | ); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | { |
119 | 119 | if (!isset($this->routeManager)) { |
120 | 120 | $config = $this->config(); |
121 | - $routes = (isset($config['routes']) ? $config['routes'] : [] ); |
|
121 | + $routes = (isset($config['routes']) ? $config['routes'] : []); |
|
122 | 122 | |
123 | 123 | $this->routeManager = new RouteManager([ |
124 | 124 | 'config' => $routes, |
@@ -87,22 +87,22 @@ |
||
87 | 87 | $method = $matches[2]; |
88 | 88 | |
89 | 89 | if (is_object($context)) { |
90 | - $callable = [ $context, $method ]; |
|
90 | + $callable = [$context, $method]; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | if (!is_callable($callable)) { |
94 | 94 | switch ($class) { |
95 | 95 | case '': |
96 | 96 | case 'self': |
97 | - $callable = [ $this, $method ]; |
|
97 | + $callable = [$this, $method]; |
|
98 | 98 | break; |
99 | 99 | |
100 | 100 | case 'static': |
101 | - $callable = [ static::class, $method ]; |
|
101 | + $callable = [static::class, $method]; |
|
102 | 102 | break; |
103 | 103 | |
104 | 104 | case 'parent': |
105 | - $callable = [ $this, 'parent::'.$method ]; |
|
105 | + $callable = [$this, 'parent::'.$method]; |
|
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | foreach ($params as $key => $param) { |
55 | 55 | $setter = $this->setter($key); |
56 | 56 | |
57 | - if (!is_callable([ $this, $setter ])) { |
|
57 | + if (!is_callable([$this, $setter])) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @var string[] |
42 | 42 | */ |
43 | - private $methods = [ 'GET' ]; |
|
43 | + private $methods = ['GET']; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Response controller classname |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | public function processMultiplePaths($paths) |
39 | 39 | { |
40 | 40 | $paths = $this->parseAsArray($paths); |
41 | - $paths = array_map([ $this, 'filterPath' ], $paths); |
|
42 | - $paths = array_filter($paths, [ $this, 'pathExists' ]); |
|
41 | + $paths = array_map([$this, 'filterPath'], $paths); |
|
42 | + $paths = array_filter($paths, [$this, 'pathExists']); |
|
43 | 43 | |
44 | 44 | if ($paths === false) { |
45 | 45 | throw new InvalidArgumentException('Received invalid paths.'); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $depth = 1; |
163 | 163 | $files = glob($pattern, $flags); |
164 | - foreach (glob(dirname($pattern).'/*', (GLOB_ONLYDIR|GLOB_NOSORT)) as $dir) { |
|
164 | + foreach (glob(dirname($pattern).'/*', (GLOB_ONLYDIR | GLOB_NOSORT)) as $dir) { |
|
165 | 165 | $files = array_merge($files, $this->globRecursive($dir.'/'.basename($pattern), $flags)); |
166 | 166 | $depth++; |
167 | 167 | if ($maxDepth > 0 && $depth >= $maxDepth) { |
@@ -60,8 +60,8 @@ |
||
60 | 60 | private function registerProviderFactory() |
61 | 61 | { |
62 | 62 | /** |
63 | - * @return Factory |
|
64 | - */ |
|
63 | + * @return Factory |
|
64 | + */ |
|
65 | 65 | if (!isset($this['provider/factory'])) { |
66 | 66 | $this['provider/factory'] = function () { |
67 | 67 | return new Factory([ |
@@ -63,7 +63,7 @@ |
||
63 | 63 | * @return Factory |
64 | 64 | */ |
65 | 65 | if (!isset($this['provider/factory'])) { |
66 | - $this['provider/factory'] = function () { |
|
66 | + $this['provider/factory'] = function() { |
|
67 | 67 | return new Factory([ |
68 | 68 | 'base_class' => ServiceProviderInterface::class, |
69 | 69 | 'resolver_options' => [ |
@@ -473,8 +473,8 @@ |
||
473 | 473 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
474 | 474 | |
475 | 475 | $uri = $baseUrl->withPath($path) |
476 | - ->withQuery($query) |
|
477 | - ->withFragment($hash); |
|
476 | + ->withQuery($query) |
|
477 | + ->withFragment($hash); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param Container $container A service container. |
122 | 122 | * @return boolean |
123 | 123 | */ |
124 | - $container['debug'] = function (Container $container) { |
|
124 | + $container['debug'] = function(Container $container) { |
|
125 | 125 | if (isset($container['config']['debug'])) { |
126 | 126 | return !!$container['config']['debug']; |
127 | 127 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param Container $container A service container. |
143 | 143 | * @return \Psr\Http\Message\UriInterface |
144 | 144 | */ |
145 | - $container['base-url'] = function (Container $container) { |
|
145 | + $container['base-url'] = function(Container $container) { |
|
146 | 146 | if (isset($container['config']['base_url'])) { |
147 | 147 | $baseUrl = $container['config']['base_url']; |
148 | 148 | } else { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param Container $container A container instance. |
194 | 194 | * @return \Charcoal\App\Handler\HandlerInterface |
195 | 195 | */ |
196 | - $container->extend('notFoundHandler', function ($handler, Container $container) use ($handlersConfig) { |
|
196 | + $container->extend('notFoundHandler', function($handler, Container $container) use ($handlersConfig) { |
|
197 | 197 | if ($handler instanceof \Slim\Handlers\NotFound) { |
198 | 198 | $config = ($handlersConfig['notFound'] ?? []); |
199 | 199 | $class = $container['notFoundHandler/class']; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param Container $container A container instance. |
214 | 214 | * @return \Charcoal\App\Handler\HandlerInterface |
215 | 215 | */ |
216 | - $container->extend('notAllowedHandler', function ($handler, Container $container) use ($handlersConfig) { |
|
216 | + $container->extend('notAllowedHandler', function($handler, Container $container) use ($handlersConfig) { |
|
217 | 217 | if ($handler instanceof \Slim\Handlers\NotAllowed) { |
218 | 218 | $config = ($handlersConfig['notAllowed'] ?? []); |
219 | 219 | $class = $container['notAllowedHandler/class']; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param Container $container A container instance. |
234 | 234 | * @return \Charcoal\App\Handler\HandlerInterface |
235 | 235 | */ |
236 | - $container->extend('phpErrorHandler', function ($handler, Container $container) use ($handlersConfig) { |
|
236 | + $container->extend('phpErrorHandler', function($handler, Container $container) use ($handlersConfig) { |
|
237 | 237 | if ($handler instanceof \Slim\Handlers\PhpError) { |
238 | 238 | $config = ($handlersConfig['phpError'] ?? []); |
239 | 239 | $class = $container['phpErrorHandler/class']; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param Container $container A container instance. |
254 | 254 | * @return \Charcoal\App\Handler\HandlerInterface |
255 | 255 | */ |
256 | - $container->extend('errorHandler', function ($handler, Container $container) use ($handlersConfig) { |
|
256 | + $container->extend('errorHandler', function($handler, Container $container) use ($handlersConfig) { |
|
257 | 257 | if ($handler instanceof \Slim\Handlers\Error) { |
258 | 258 | $config = ($handlersConfig['error'] ?? []); |
259 | 259 | $class = $container['errorHandler/class']; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param Container $container A service container. |
275 | 275 | * @return \Charcoal\App\Handler\HandlerInterface |
276 | 276 | */ |
277 | - $container['maintenanceHandler'] = function (Container $container) use ($handlersConfig) { |
|
277 | + $container['maintenanceHandler'] = function(Container $container) use ($handlersConfig) { |
|
278 | 278 | $config = ($handlersConfig['maintenance'] ?? []); |
279 | 279 | $class = $container['maintenanceHandler/class']; |
280 | 280 | $handler = new $class($container, $config); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @param Container $container A service container. |
303 | 303 | * @return \Charcoal\Factory\FactoryInterface |
304 | 304 | */ |
305 | - $container['route/factory'] = function (Container $container) { |
|
305 | + $container['route/factory'] = function(Container $container) { |
|
306 | 306 | return new Factory([ |
307 | 307 | 'base_class' => RouteInterface::class, |
308 | 308 | 'resolver_options' => [ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param Container $container A service container. |
349 | 349 | * @return \Charcoal\Factory\FactoryInterface |
350 | 350 | */ |
351 | - $container['action/factory'] = function (Container $container) { |
|
351 | + $container['action/factory'] = function(Container $container) { |
|
352 | 352 | return new Factory([ |
353 | 353 | 'base_class' => ActionInterface::class, |
354 | 354 | 'resolver_options' => [ |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @param Container $container A service container. |
373 | 373 | * @return \Charcoal\Factory\FactoryInterface |
374 | 374 | */ |
375 | - $container['template/factory'] = function (Container $container) { |
|
375 | + $container['template/factory'] = function(Container $container) { |
|
376 | 376 | return new Factory([ |
377 | 377 | 'base_class' => TemplateInterface::class, |
378 | 378 | 'resolver_options' => [ |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @param Container $container A service container. |
397 | 397 | * @return \Charcoal\Factory\FactoryInterface |
398 | 398 | */ |
399 | - $container['widget/factory'] = function (Container $container) { |
|
399 | + $container['widget/factory'] = function(Container $container) { |
|
400 | 400 | return new Factory([ |
401 | 401 | 'base_class' => WidgetInterface::class, |
402 | 402 | 'resolver_options' => [ |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param Container $container A service container. |
416 | 416 | * @return WidgetBuilder |
417 | 417 | */ |
418 | - $container['widget/builder'] = function (Container $container) { |
|
418 | + $container['widget/builder'] = function(Container $container) { |
|
419 | 419 | return new WidgetBuilder($container['widget/factory'], $container); |
420 | 420 | }; |
421 | 421 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @param Container $container A service container. |
435 | 435 | * @return \Charcoal\Factory\FactoryInterface |
436 | 436 | */ |
437 | - $container['module/factory'] = function (Container $container) { |
|
437 | + $container['module/factory'] = function(Container $container) { |
|
438 | 438 | return new Factory([ |
439 | 439 | 'base_class' => ModuleInterface::class, |
440 | 440 | 'resolver_options' => [ |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * @param Container $container A service container. |
455 | 455 | * @return array |
456 | 456 | */ |
457 | - $container['module/classes'] = function (Container $container) { |
|
457 | + $container['module/classes'] = function(Container $container) { |
|
458 | 458 | $appConfig = $container['config']; |
459 | 459 | |
460 | 460 | $modules = $appConfig['modules']; |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | 'suffix' => 'Module', |
465 | 465 | ]); |
466 | 466 | |
467 | - $modules = array_map(function ($module) use ($moduleResolver) { |
|
467 | + $modules = array_map(function($module) use ($moduleResolver) { |
|
468 | 468 | return $moduleResolver->resolve($module); |
469 | 469 | }, $modules); |
470 | 470 | |
471 | - array_filter($modules, function ($class) { |
|
471 | + array_filter($modules, function($class) { |
|
472 | 472 | return class_exists($class); |
473 | 473 | }); |
474 | 474 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | protected function registerViewServices(Container $container) |
486 | 486 | { |
487 | 487 | if (!isset($container['view/mustache/helpers'])) { |
488 | - $container['view/mustache/helpers'] = function () { |
|
488 | + $container['view/mustache/helpers'] = function() { |
|
489 | 489 | return []; |
490 | 490 | }; |
491 | 491 | } |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return array |
497 | 497 | */ |
498 | - $container->extend('view/mustache/helpers', function (array $helpers, Container $container) { |
|
498 | + $container->extend('view/mustache/helpers', function(array $helpers, Container $container) { |
|
499 | 499 | $baseUrl = $container['base-url']; |
500 | 500 | $urls = [ |
501 | 501 | /** |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * @param string $uri A URI path to wrap. |
523 | 523 | * @return UriInterface|null |
524 | 524 | */ |
525 | - 'withBaseUrl' => function ($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
525 | + 'withBaseUrl' => function($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
526 | 526 | if ($helper) { |
527 | 527 | $uri = $helper->render($uri); |
528 | 528 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } else { |
534 | 534 | $parts = parse_url($uri); |
535 | 535 | if (!isset($parts['scheme'])) { |
536 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
536 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
537 | 537 | $path = isset($parts['path']) ? $parts['path'] : ''; |
538 | 538 | $query = isset($parts['query']) ? $parts['query'] : ''; |
539 | 539 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | return $uri; |
549 | 549 | }, |
550 | - 'renderContext' => function ($text, LambdaHelper $helper = null) { |
|
550 | + 'renderContext' => function($text, LambdaHelper $helper = null) { |
|
551 | 551 | return $helper->render('{{>'.$helper->render($text).'}}'); |
552 | 552 | }, |
553 | 553 | ]; |
@@ -79,7 +79,7 @@ |
||
79 | 79 | |
80 | 80 | return $this->respondWith( |
81 | 81 | $response->withStatus($status) |
82 | - ->withHeader('Allow', $this->getMethods()), |
|
82 | + ->withHeader('Allow', $this->getMethods()), |
|
83 | 83 | $contentType, |
84 | 84 | $output |
85 | 85 | ); |