| @@ -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 | ); | 
| @@ -8,7 +8,6 @@ | ||
| 8 | 8 | use Charcoal\App\App; | 
| 9 | 9 | |
| 10 | 10 | // Dependencies from 'charcoal-translator' | 
| 11 | -use Charcoal\Translator\Translation; | |
| 12 | 11 | |
| 13 | 12 | // Local namespace dependencies | 
| 14 | 13 | use Charcoal\App\Route\RouteConfig; | 
| @@ -467,7 +467,7 @@ discard block | ||
| 467 | 467 | |
| 468 | 468 | /** | 
| 469 | 469 | * @param array $databases The avaiable databases config. | 
| 470 | - * @return Config Chainable | |
| 470 | + * @return AppConfig Chainable | |
| 471 | 471 | */ | 
| 472 | 472 | public function setDatabases(array $databases) | 
| 473 | 473 |      { | 
| @@ -550,7 +550,7 @@ discard block | ||
| 550 | 550 | |
| 551 | 551 | /** | 
| 552 | 552 | * @throws Exception If trying to access this method before a setter. | 
| 553 | - * @return mixed | |
| 553 | + * @return string | |
| 554 | 554 | */ | 
| 555 | 555 | public function defaultDatabase() | 
| 556 | 556 |      { | 
| @@ -436,7 +436,7 @@ | ||
| 436 | 436 | $this->routes = []; | 
| 437 | 437 | } | 
| 438 | 438 | |
| 439 | - $toIterate = [ 'templates', 'actions', 'scripts' ]; | |
| 439 | + $toIterate = ['templates', 'actions', 'scripts']; | |
| 440 | 440 |          foreach ($routes as $key => $val) { | 
| 441 | 441 |              if (in_array($key, $toIterate) && isset($this->routes[$key])) { | 
| 442 | 442 | $this->routes[$key] = array_merge($this->routes[$key], $val); | 
| @@ -141,7 +141,7 @@ | ||
| 141 | 141 | * | 
| 142 | 142 | * @see ConfigurableTrait::createConfig() | 
| 143 | 143 | * @param mixed|null $data Optional config data. | 
| 144 | - * @return ConfigInterface | |
| 144 | + * @return HandlerConfig | |
| 145 | 145 | */ | 
| 146 | 146 | public function createConfig($data = null) | 
| 147 | 147 |      { | 
| @@ -7,7 +7,6 @@ discard block | ||
| 7 | 7 | use Psr\Log\LoggerAwareTrait; | 
| 8 | 8 | |
| 9 | 9 | // Dependencies from PSR-7 (HTTP Messaging) | 
| 10 | -use Psr\Http\Message\ResponseInterface; | |
| 11 | 10 | use Psr\Http\Message\ServerRequestInterface; | 
| 12 | 11 | use Psr\Http\Message\UriInterface; | 
| 13 | 12 | |
| @@ -28,7 +27,6 @@ discard block | ||
| 28 | 27 | |
| 29 | 28 | // Intra-module (`charcoal-app`) dependencies | 
| 30 | 29 | use Charcoal\App\AppConfig; | 
| 31 | -use Charcoal\App\Template\TemplateInterface; | |
| 32 | 30 | use Charcoal\App\Handler\HandlerInterface; | 
| 33 | 31 | use Charcoal\App\Handler\HandlerConfig; | 
| 34 | 32 | |
| @@ -81,7 +81,7 @@ | ||
| 81 | 81 | /** | 
| 82 | 82 | * Set the HTTP methods allowed by the current request. | 
| 83 | 83 | * | 
| 84 | - * @param array $methods Case-sensitive array of methods. | |
| 84 | + * @param string[] $methods Case-sensitive array of methods. | |
| 85 | 85 | * @return NotAllowed Chainable | 
| 86 | 86 | */ | 
| 87 | 87 | protected function setMethods(array $methods) | 
| @@ -30,17 +30,17 @@ discard block | ||
| 30 | 30 | $routes = $this->config(); | 
| 31 | 31 | |
| 32 | 32 |          if (PHP_SAPI == 'cli') { | 
| 33 | - $scripts = ( isset($routes['scripts']) ? $routes['scripts'] : [] ); | |
| 33 | + $scripts = (isset($routes['scripts']) ? $routes['scripts'] : []); | |
| 34 | 34 |              foreach ($scripts as $scriptIdent => $scriptConfig) { | 
| 35 | 35 | $this->setupScript($scriptIdent, $scriptConfig); | 
| 36 | 36 | } | 
| 37 | 37 |          } else { | 
| 38 | - $templates = ( isset($routes['templates']) ? $routes['templates'] : [] ); | |
| 38 | + $templates = (isset($routes['templates']) ? $routes['templates'] : []); | |
| 39 | 39 |              foreach ($templates as $routeIdent => $templateConfig) { | 
| 40 | 40 | $this->setupTemplate($routeIdent, $templateConfig); | 
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | - $actions = ( isset($routes['actions']) ? $routes['actions'] : [] ); | |
| 43 | + $actions = (isset($routes['actions']) ? $routes['actions'] : []); | |
| 44 | 44 |              foreach ($actions as $actionIdent => $actionConfig) { | 
| 45 | 45 | $this->setupAction($actionIdent, $actionConfig); | 
| 46 | 46 | } | 
| @@ -66,12 +66,12 @@ discard block | ||
| 66 | 66 | |
| 67 | 67 | $methods = isset($templateConfig['methods']) | 
| 68 | 68 | ? $templateConfig['methods'] | 
| 69 | - : [ 'GET' ]; | |
| 69 | + : ['GET']; | |
| 70 | 70 | |
| 71 | 71 | $routeHandler = $this->app()->map( | 
| 72 | 72 | $methods, | 
| 73 | 73 | $routePattern, | 
| 74 | - function ( | |
| 74 | + function( | |
| 75 | 75 | RequestInterface $request, | 
| 76 | 76 | ResponseInterface $response, | 
| 77 | 77 | array $args = [] | 
| @@ -144,12 +144,12 @@ discard block | ||
| 144 | 144 | |
| 145 | 145 | $methods = isset($actionConfig['methods']) | 
| 146 | 146 | ? $actionConfig['methods'] | 
| 147 | - : [ 'POST' ]; | |
| 147 | + : ['POST']; | |
| 148 | 148 | |
| 149 | 149 | $routeHandler = $this->app()->map( | 
| 150 | 150 | $methods, | 
| 151 | 151 | $routePattern, | 
| 152 | - function ( | |
| 152 | + function( | |
| 153 | 153 | RequestInterface $request, | 
| 154 | 154 | ResponseInterface $response, | 
| 155 | 155 | array $args = [] | 
| @@ -222,12 +222,12 @@ discard block | ||
| 222 | 222 | |
| 223 | 223 | $methods = isset($scriptConfig['methods']) | 
| 224 | 224 | ? $scriptConfig['methods'] | 
| 225 | - : [ 'GET' ]; | |
| 225 | + : ['GET']; | |
| 226 | 226 | |
| 227 | 227 | $routeHandler = $this->app()->map( | 
| 228 | 228 | $methods, | 
| 229 | 229 | $routePattern, | 
| 230 | - function ( | |
| 230 | + function( | |
| 231 | 231 | RequestInterface $request, | 
| 232 | 232 | ResponseInterface $response, | 
| 233 | 233 | array $args = [] | 
| @@ -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, | 
| @@ -51,9 +51,9 @@ | ||
| 51 | 51 | $lockFile = sys_get_temp_dir().'/'.$lockName; | 
| 52 | 52 | $this->lockFilePointer = fopen($lockFile, 'w'); | 
| 53 | 53 |          if (!$this->lockFilePointer) { | 
| 54 | - throw new Exception( | |
| 55 | -                 sprintf('Can not run action. Lock file "%s" not available.', $lockFile) | |
| 56 | - ); | |
| 54 | + throw new Exception( | |
| 55 | +                    sprintf('Can not run action. Lock file "%s" not available.', $lockFile) | |
| 56 | + ); | |
| 57 | 57 | } | 
| 58 | 58 |          if (flock($this->lockFilePointer, LOCK_EX)) { | 
| 59 | 59 | return true; | 
| @@ -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 | |