@@ -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 | |
@@ -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 | } |
@@ -32,29 +32,22 @@ |
||
| 32 | 32 | |
| 33 | 33 | // From 'charcoal-app' |
| 34 | 34 | use Charcoal\App\AppConfig; |
| 35 | - |
|
| 36 | 35 | use Charcoal\App\Action\ActionInterface; |
| 37 | 36 | use Charcoal\App\Script\ScriptInterface; |
| 38 | 37 | use Charcoal\App\Module\ModuleInterface; |
| 39 | - |
|
| 40 | 38 | use Charcoal\App\Middleware\IpMiddleware; |
| 41 | - |
|
| 42 | 39 | use Charcoal\App\Route\ActionRoute; |
| 43 | 40 | use Charcoal\App\Route\RouteInterface; |
| 44 | 41 | use Charcoal\App\Route\ScriptRoute; |
| 45 | 42 | use Charcoal\App\Route\TemplateRoute; |
| 46 | - |
|
| 47 | 43 | use Charcoal\App\Handler\Error; |
| 48 | 44 | use Charcoal\App\Handler\PhpError; |
| 49 | 45 | use Charcoal\App\Handler\Maintenance; |
| 50 | 46 | use Charcoal\App\Handler\NotAllowed; |
| 51 | 47 | use Charcoal\App\Handler\NotFound; |
| 52 | - |
|
| 53 | 48 | use Charcoal\App\Template\TemplateInterface; |
| 54 | -use Charcoal\App\Template\TemplateBuilder; |
|
| 55 | 49 | use Charcoal\App\Template\WidgetInterface; |
| 56 | 50 | use Charcoal\App\Template\WidgetBuilder; |
| 57 | - |
|
| 58 | 51 | use Charcoal\App\ServiceProvider\DatabaseServiceProvider; |
| 59 | 52 | use Charcoal\App\ServiceProvider\FilesystemServiceProvider; |
| 60 | 53 | use Charcoal\App\ServiceProvider\LoggerServiceProvider; |
@@ -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 { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param Container $container A container instance. |
| 179 | 179 | * @return \Charcoal\App\Handler\HandlerInterface |
| 180 | 180 | */ |
| 181 | - $container->extend('notFoundHandler', function ($handler, Container $container) use ($config) { |
|
| 181 | + $container->extend('notFoundHandler', function($handler, Container $container) use ($config) { |
|
| 182 | 182 | if ($handler instanceof \Slim\Handlers\NotFound) { |
| 183 | 183 | $notFoundConfig = isset($config['notFound']) ? $config['notFound'] : []; |
| 184 | 184 | $handler = new NotFound($container, $notFoundConfig); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param Container $container A container instance. |
| 198 | 198 | * @return \Charcoal\App\Handler\HandlerInterface |
| 199 | 199 | */ |
| 200 | - $container->extend('notAllowedHandler', function ($handler, Container $container) use ($config) { |
|
| 200 | + $container->extend('notAllowedHandler', function($handler, Container $container) use ($config) { |
|
| 201 | 201 | if ($handler instanceof \Slim\Handlers\NotAllowed) { |
| 202 | 202 | $notAllowedConfig = isset($config['notAllowed']) ? $config['notAllowed'] : []; |
| 203 | 203 | $handler = new NotAllowed($container, $notAllowedConfig); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param Container $container A container instance. |
| 217 | 217 | * @return \Charcoal\App\Handler\HandlerInterface |
| 218 | 218 | */ |
| 219 | - $container->extend('phpErrorHandler', function ($handler, Container $container) use ($config) { |
|
| 219 | + $container->extend('phpErrorHandler', function($handler, Container $container) use ($config) { |
|
| 220 | 220 | if ($handler instanceof \Slim\Handlers\PhpError) { |
| 221 | 221 | $phpErrorConfig = isset($config['phpError']) ? $config['phpError'] : []; |
| 222 | 222 | $handler = new PhpError($container, $phpErrorConfig); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @param Container $container A container instance. |
| 236 | 236 | * @return \Charcoal\App\Handler\HandlerInterface |
| 237 | 237 | */ |
| 238 | - $container->extend('errorHandler', function ($handler, Container $container) use ($config) { |
|
| 238 | + $container->extend('errorHandler', function($handler, Container $container) use ($config) { |
|
| 239 | 239 | if ($handler instanceof \Slim\Handlers\Error) { |
| 240 | 240 | $errorConfig = isset($config['error']) ? $config['error'] : []; |
| 241 | 241 | $handler = new Error($container, $errorConfig); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @param Container $container A Pimple DI container. |
| 256 | 256 | * @return \Charcoal\App\Handler\HandlerInterface |
| 257 | 257 | */ |
| 258 | - $container['maintenanceHandler'] = function (Container $container) use ($config) { |
|
| 258 | + $container['maintenanceHandler'] = function(Container $container) use ($config) { |
|
| 259 | 259 | $maintenanceConfig = isset($config['maintenance']) ? $config['maintenance'] : []; |
| 260 | 260 | $handler = new Maintenance($container, $maintenanceConfig); |
| 261 | 261 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @param Container $container A container instance. |
| 286 | 286 | * @return \Charcoal\Factory\FactoryInterface |
| 287 | 287 | */ |
| 288 | - $container['route/factory'] = function (Container $container) { |
|
| 288 | + $container['route/factory'] = function(Container $container) { |
|
| 289 | 289 | return new Factory([ |
| 290 | 290 | 'base_class' => RouteInterface::class, |
| 291 | 291 | 'resolver_options' => [ |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @param Container $container A container instance. |
| 330 | 330 | * @return \Charcoal\Factory\FactoryInterface |
| 331 | 331 | */ |
| 332 | - $container['action/factory'] = function (Container $container) { |
|
| 332 | + $container['action/factory'] = function(Container $container) { |
|
| 333 | 333 | return new Factory([ |
| 334 | 334 | 'base_class' => ActionInterface::class, |
| 335 | 335 | 'resolver_options' => [ |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param Container $container A container instance. |
| 353 | 353 | * @return \Charcoal\Factory\FactoryInterface |
| 354 | 354 | */ |
| 355 | - $container['script/factory'] = function (Container $container) { |
|
| 355 | + $container['script/factory'] = function(Container $container) { |
|
| 356 | 356 | return new Factory([ |
| 357 | 357 | 'base_class' => ScriptInterface::class, |
| 358 | 358 | 'resolver_options' => [ |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * @param Container $container A container instance. |
| 377 | 377 | * @return \Charcoal\Factory\FactoryInterface |
| 378 | 378 | */ |
| 379 | - $container['template/factory'] = function (Container $container) { |
|
| 379 | + $container['template/factory'] = function(Container $container) { |
|
| 380 | 380 | return new Factory([ |
| 381 | 381 | 'base_class' => TemplateInterface::class, |
| 382 | 382 | 'resolver_options' => [ |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | * @param Container $container A container instance. |
| 399 | 399 | * @return \Charcoal\Factory\FactoryInterface |
| 400 | 400 | */ |
| 401 | - $container['widget/factory'] = function (Container $container) { |
|
| 401 | + $container['widget/factory'] = function(Container $container) { |
|
| 402 | 402 | return new Factory([ |
| 403 | 403 | 'base_class' => WidgetInterface::class, |
| 404 | 404 | 'resolver_options' => [ |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * @param Container $container A container instance. |
| 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 container instance. |
| 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' => [ |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * @param Container $container A container instance. |
| 453 | 453 | * @return array |
| 454 | 454 | */ |
| 455 | - $container['module/classes'] = function (Container $container) { |
|
| 455 | + $container['module/classes'] = function(Container $container) { |
|
| 456 | 456 | $appConfig = $container['config']; |
| 457 | 457 | |
| 458 | 458 | $modules = $appConfig['modules']; |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | 'suffix' => 'Module' |
| 463 | 463 | ]); |
| 464 | 464 | |
| 465 | - $modules = array_map(function ($module) use ($moduleResolver) { |
|
| 465 | + $modules = array_map(function($module) use ($moduleResolver) { |
|
| 466 | 466 | return $moduleResolver->resolve($module); |
| 467 | 467 | }, $modules); |
| 468 | 468 | |
| 469 | - array_filter($modules, function ($class) { |
|
| 469 | + array_filter($modules, function($class) { |
|
| 470 | 470 | return class_exists($class); |
| 471 | 471 | }); |
| 472 | 472 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * @param Container $container A container instance. |
| 485 | 485 | * @return null|\League\CLImate\Util\Reader\ReaderInterface |
| 486 | 486 | */ |
| 487 | - $container['climate/reader'] = function (Container $container) { |
|
| 487 | + $container['climate/reader'] = function(Container $container) { |
|
| 488 | 488 | return null; |
| 489 | 489 | }; |
| 490 | 490 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * @param Container $container A container instance. |
| 493 | 493 | * @return CLImate |
| 494 | 494 | */ |
| 495 | - $container['climate'] = function () { |
|
| 495 | + $container['climate'] = function() { |
|
| 496 | 496 | $climate = new CLImate(); |
| 497 | 497 | return $climate; |
| 498 | 498 | }; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | protected function registerViewServices(Container $container) |
| 508 | 508 | { |
| 509 | 509 | if (!isset($container['view/mustache/helpers'])) { |
| 510 | - $container['view/mustache/helpers'] = function () { |
|
| 510 | + $container['view/mustache/helpers'] = function() { |
|
| 511 | 511 | return []; |
| 512 | 512 | }; |
| 513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * |
| 518 | 518 | * @return array |
| 519 | 519 | */ |
| 520 | - $container->extend('view/mustache/helpers', function (array $helpers, Container $container) { |
|
| 520 | + $container->extend('view/mustache/helpers', function(array $helpers, Container $container) { |
|
| 521 | 521 | $baseUrl = $container['base-url']; |
| 522 | 522 | $urls = [ |
| 523 | 523 | /** |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * @param string $uri A URI path to wrap. |
| 545 | 545 | * @return UriInterface|null |
| 546 | 546 | */ |
| 547 | - 'withBaseUrl' => function ($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
| 547 | + 'withBaseUrl' => function($uri, LambdaHelper $helper = null) use ($baseUrl) { |
|
| 548 | 548 | if ($helper) { |
| 549 | 549 | $uri = $helper->render($uri); |
| 550 | 550 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | } else { |
| 556 | 556 | $parts = parse_url($uri); |
| 557 | 557 | if (!isset($parts['scheme'])) { |
| 558 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
| 558 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
| 559 | 559 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 560 | 560 | $query = isset($parts['query']) ? $parts['query'] : ''; |
| 561 | 561 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
@@ -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 | ); |
@@ -6,14 +6,10 @@ |
||
| 6 | 6 | |
| 7 | 7 | // From PSR-7 |
| 8 | 8 | use Psr\Http\Message\ServerRequestInterface; |
| 9 | -use Psr\Http\Message\ResponseInterface; |
|
| 10 | -use Psr\Http\Message\UriInterface; |
|
| 11 | 9 | |
| 12 | 10 | // From Pimple |
| 13 | -use Pimple\Container; |
|
| 14 | 11 | |
| 15 | 12 | // From 'charcoal-translator' |
| 16 | -use Charcoal\Translator\Translator; |
|
| 17 | 13 | |
| 18 | 14 | // From 'charcoal-view' |
| 19 | 15 | use Charcoal\View\ViewInterface; |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | /** |
| 130 | 130 | * Retrieve the final handler data for rendering the view. |
| 131 | 131 | * |
| 132 | - * @return array Finalized template data. |
|
| 132 | + * @return string Finalized template data. |
|
| 133 | 133 | */ |
| 134 | 134 | final protected function templatePartial() |
| 135 | 135 | { |