@@ -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 | ); |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use InvalidArgumentException; |
6 | 6 | |
7 | 7 | // From 'charcoal-translator' |
8 | -use Charcoal\Translator\Translation; |
|
9 | 8 | |
10 | 9 | // From 'charcoal-app' |
11 | 10 | use Charcoal\App\App; |
@@ -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 | } |
@@ -14,7 +14,6 @@ discard block |
||
14 | 14 | use Slim\Http\Uri; |
15 | 15 | |
16 | 16 | // From 'league/climate' |
17 | -use League\CLImate\CLImate; |
|
18 | 17 | |
19 | 18 | // From Mustache |
20 | 19 | use Mustache_LambdaHelper as LambdaHelper; |
@@ -33,28 +32,20 @@ discard block |
||
33 | 32 | |
34 | 33 | // From 'charcoal-app' |
35 | 34 | use Charcoal\App\AppConfig; |
36 | - |
|
37 | 35 | use Charcoal\App\Action\ActionInterface; |
38 | -use Charcoal\App\Script\ScriptInterface; |
|
39 | 36 | use Charcoal\App\Module\ModuleInterface; |
40 | - |
|
41 | 37 | use Charcoal\App\Middleware\IpMiddleware; |
42 | - |
|
43 | 38 | use Charcoal\App\Route\ActionRoute; |
44 | 39 | use Charcoal\App\Route\RouteInterface; |
45 | 40 | use Charcoal\App\Route\TemplateRoute; |
46 | - |
|
47 | 41 | use Charcoal\App\Handler\Error; |
48 | 42 | use Charcoal\App\Handler\PhpError; |
49 | 43 | use Charcoal\App\Handler\Maintenance; |
50 | 44 | use Charcoal\App\Handler\NotAllowed; |
51 | 45 | use Charcoal\App\Handler\NotFound; |
52 | - |
|
53 | 46 | use Charcoal\App\Template\TemplateInterface; |
54 | -use Charcoal\App\Template\TemplateBuilder; |
|
55 | 47 | use Charcoal\App\Template\WidgetInterface; |
56 | 48 | use Charcoal\App\Template\WidgetBuilder; |
57 | - |
|
58 | 49 | use Charcoal\App\ServiceProvider\DatabaseServiceProvider; |
59 | 50 | use Charcoal\App\ServiceProvider\FilesystemServiceProvider; |
60 | 51 | use Charcoal\App\ServiceProvider\ScriptServiceProvider; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param Container $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 | $debug = !!$container['config']['debug']; |
127 | 127 | } elseif (isset($container['config']['dev_mode'])) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param Container $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 = isset($handlersConfig['notFound']) ? $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 = isset($handlersConfig['notAllowed']) ? $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 = isset($handlersConfig['phpError']) ? $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 = isset($handlersConfig['error']) ? $handlersConfig['error'] : []; |
259 | 259 | $class = $container['errorHandler/class']; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param Container $container A Pimple DI 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 = isset($handlersConfig['maintenance']) ? $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 container instance. |
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' => [ |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param Container $container A container instance. |
347 | 347 | * @return \Charcoal\Factory\FactoryInterface |
348 | 348 | */ |
349 | - $container['action/factory'] = function (Container $container) { |
|
349 | + $container['action/factory'] = function(Container $container) { |
|
350 | 350 | return new Factory([ |
351 | 351 | 'base_class' => ActionInterface::class, |
352 | 352 | 'resolver_options' => [ |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @param Container $container A container instance. |
370 | 370 | * @return \Charcoal\Factory\FactoryInterface |
371 | 371 | */ |
372 | - $container['template/factory'] = function (Container $container) { |
|
372 | + $container['template/factory'] = function(Container $container) { |
|
373 | 373 | return new Factory([ |
374 | 374 | 'base_class' => TemplateInterface::class, |
375 | 375 | 'resolver_options' => [ |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param Container $container A container instance. |
392 | 392 | * @return \Charcoal\Factory\FactoryInterface |
393 | 393 | */ |
394 | - $container['widget/factory'] = function (Container $container) { |
|
394 | + $container['widget/factory'] = function(Container $container) { |
|
395 | 395 | return new Factory([ |
396 | 396 | 'base_class' => WidgetInterface::class, |
397 | 397 | 'resolver_options' => [ |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param Container $container A container instance. |
409 | 409 | * @return WidgetBuilder |
410 | 410 | */ |
411 | - $container['widget/builder'] = function (Container $container) { |
|
411 | + $container['widget/builder'] = function(Container $container) { |
|
412 | 412 | return new WidgetBuilder($container['widget/factory'], $container); |
413 | 413 | }; |
414 | 414 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param Container $container A container instance. |
428 | 428 | * @return \Charcoal\Factory\FactoryInterface |
429 | 429 | */ |
430 | - $container['module/factory'] = function (Container $container) { |
|
430 | + $container['module/factory'] = function(Container $container) { |
|
431 | 431 | return new Factory([ |
432 | 432 | 'base_class' => ModuleInterface::class, |
433 | 433 | 'resolver_options' => [ |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @param Container $container A container instance. |
446 | 446 | * @return array |
447 | 447 | */ |
448 | - $container['module/classes'] = function (Container $container) { |
|
448 | + $container['module/classes'] = function(Container $container) { |
|
449 | 449 | $appConfig = $container['config']; |
450 | 450 | |
451 | 451 | $modules = $appConfig['modules']; |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | 'suffix' => 'Module' |
456 | 456 | ]); |
457 | 457 | |
458 | - $modules = array_map(function ($module) use ($moduleResolver) { |
|
458 | + $modules = array_map(function($module) use ($moduleResolver) { |
|
459 | 459 | return $moduleResolver->resolve($module); |
460 | 460 | }, $modules); |
461 | 461 | |
462 | - array_filter($modules, function ($class) { |
|
462 | + array_filter($modules, function($class) { |
|
463 | 463 | return class_exists($class); |
464 | 464 | }); |
465 | 465 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | protected function registerViewServices(Container $container) |
477 | 477 | { |
478 | 478 | if (!isset($container['view/mustache/helpers'])) { |
479 | - $container['view/mustache/helpers'] = function () { |
|
479 | + $container['view/mustache/helpers'] = function() { |
|
480 | 480 | return []; |
481 | 481 | }; |
482 | 482 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * |
487 | 487 | * @return array |
488 | 488 | */ |
489 | - $container->extend('view/mustache/helpers', function (array $helpers, Container $container) { |
|
489 | + $container->extend('view/mustache/helpers', function(array $helpers, Container $container) { |
|
490 | 490 | $baseUrl = $container['base-url']; |
491 | 491 | $urls = [ |
492 | 492 | /** |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param string $uri A URI path to wrap. |
514 | 514 | * @return UriInterface|null |
515 | 515 | */ |
516 | - 'withBaseUrl' => function ($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
516 | + 'withBaseUrl' => function($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
517 | 517 | if ($helper) { |
518 | 518 | $uri = $helper->render($uri); |
519 | 519 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } else { |
525 | 525 | $parts = parse_url($uri); |
526 | 526 | if (!isset($parts['scheme'])) { |
527 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
527 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
528 | 528 | $path = isset($parts['path']) ? $parts['path'] : ''; |
529 | 529 | $query = isset($parts['query']) ? $parts['query'] : ''; |
530 | 530 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | |
539 | 539 | return $uri; |
540 | 540 | }, |
541 | - 'renderContext' => function ($text, LambdaHelper $helper = null) { |
|
541 | + 'renderContext' => function($text, LambdaHelper $helper = null) { |
|
542 | 542 | return $helper->render('{{>'.$helper->render($text).'}}'); |
543 | 543 | } |
544 | 544 | ]; |
@@ -88,7 +88,7 @@ |
||
88 | 88 | /** |
89 | 89 | * Set the HTTP methods allowed by the current request. |
90 | 90 | * |
91 | - * @param array $methods Case-sensitive array of methods. |
|
91 | + * @param string[] $methods Case-sensitive array of methods. |
|
92 | 92 | * @return self |
93 | 93 | */ |
94 | 94 | protected function setMethods(array $methods) |
@@ -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 | ); |