@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $container = $app->getContainer(); |
| 12 | 12 | |
| 13 | 13 | // PSR-3 logger with monolog |
| 14 | -$container['logger'] = function ($c) { |
|
| 14 | +$container['logger'] = function($c) { |
|
| 15 | 15 | $logger = new MonologLogger('Charcoal'); |
| 16 | 16 | $logger->pushProcessor(new UidProcessor()); |
| 17 | 17 | $logger->pushHandler(new MonologStreamHandler('charcoal.app.log', \Monolog\Logger::DEBUG)); |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | if ($name instanceof TranslationStringInterface) { |
| 95 | 95 | $config = $name->available_langs(); |
| 96 | 96 | } elseif (is_array($name)) { |
| 97 | - $config = [ 'languages' => array_keys($name) ]; |
|
| 97 | + $config = ['languages' => array_keys($name)]; |
|
| 98 | 98 | } else { |
| 99 | 99 | $config = null; |
| 100 | 100 | } |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $routes = $this->config(); |
| 51 | 51 | |
| 52 | - $templates = ( isset($routes['templates']) ? $routes['templates'] : [] ); |
|
| 52 | + $templates = (isset($routes['templates']) ? $routes['templates'] : []); |
|
| 53 | 53 | $this->logger()->debug('Templates', (array)$templates); |
| 54 | 54 | foreach ($templates as $template_ident => $template_config) { |
| 55 | - $methods = ( isset($tempate_config['methods']) ? $template_config['methods'] : [ 'GET' ] ); |
|
| 55 | + $methods = (isset($tempate_config['methods']) ? $template_config['methods'] : ['GET']); |
|
| 56 | 56 | |
| 57 | 57 | $route = $this->app()->map( |
| 58 | 58 | $methods, |
| 59 | 59 | $template_ident, |
| 60 | - function ( |
|
| 60 | + function( |
|
| 61 | 61 | RequestInterface $request, |
| 62 | 62 | ResponseInterface $response, |
| 63 | 63 | $args |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $routes = $this->config(); |
| 94 | 94 | |
| 95 | - $actions = ( isset($routes['actions']) ? $routes['actions'] : [] ); |
|
| 95 | + $actions = (isset($routes['actions']) ? $routes['actions'] : []); |
|
| 96 | 96 | $this->logger()->debug('Actions', (array)$actions); |
| 97 | 97 | foreach ($actions as $action_ident => $action_config) { |
| 98 | - $methods = ( isset($action_config['methods']) ? $action_config['methods'] : [ 'POST' ] ); |
|
| 98 | + $methods = (isset($action_config['methods']) ? $action_config['methods'] : ['POST']); |
|
| 99 | 99 | |
| 100 | 100 | $route = $this->app()->map( |
| 101 | 101 | $methods, |
| 102 | 102 | $action_ident, |
| 103 | - function ( |
|
| 103 | + function( |
|
| 104 | 104 | RequestInterface $request, |
| 105 | 105 | ResponseInterface $response, |
| 106 | 106 | $args |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $routes = $this->config(); |
| 136 | 136 | |
| 137 | - $scripts = ( isset($routes['scripts']) ? $routes['scripts'] : [] ); |
|
| 137 | + $scripts = (isset($routes['scripts']) ? $routes['scripts'] : []); |
|
| 138 | 138 | $this->logger()->debug('Scripts', (array)$scripts); |
| 139 | 139 | foreach ($scripts as $script_ident => $script_config) { |
| 140 | - $methods = ( isset($script_config['methods']) ? $script_config['methods'] : [ 'GET' ] ); |
|
| 140 | + $methods = (isset($script_config['methods']) ? $script_config['methods'] : ['GET']); |
|
| 141 | 141 | |
| 142 | 142 | $route = $this->app()->map( |
| 143 | 143 | $methods, |
| 144 | 144 | $script_ident, |
| 145 | - function ( |
|
| 145 | + function( |
|
| 146 | 146 | RequestInterface $request, |
| 147 | 147 | ResponseInterface $response, |
| 148 | 148 | $args |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | if ($this->module_manager == null) { |
| 103 | 103 | $config = $this->config(); |
| 104 | - $modules = (isset($config['modules']) ? $config['modules'] : [] ); |
|
| 104 | + $modules = (isset($config['modules']) ? $config['modules'] : []); |
|
| 105 | 105 | $this->module_manager = new ModuleManager([ |
| 106 | 106 | 'config' => $modules, |
| 107 | 107 | 'app' => $this->app, |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | if ($this->route_manager === null) { |
| 120 | 120 | $config = $this->config(); |
| 121 | - $routes = (isset($config['routes']) ? $config['routes'] : [] ); |
|
| 121 | + $routes = (isset($config['routes']) ? $config['routes'] : []); |
|
| 122 | 122 | $route_manager = new RouteManager([ |
| 123 | 123 | 'config' => $routes, |
| 124 | 124 | 'app' => $this->app, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | if ($this->middleware_manager === null) { |
| 137 | 137 | $config = $this->config(); |
| 138 | - $middlewares = (isset($config['middlewares']) ? $config['middlewares'] : [] ); |
|
| 138 | + $middlewares = (isset($config['middlewares']) ? $config['middlewares'] : []); |
|
| 139 | 139 | $middleware_manager = new MiddlewareManager([ |
| 140 | 140 | 'config' => $middlewares, |
| 141 | 141 | 'app' => $this->app, |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | // For now, need to rely on a catch-all... |
| 228 | 228 | $this->app->get( |
| 229 | 229 | '{catchall:.*}', |
| 230 | - function ( |
|
| 230 | + function( |
|
| 231 | 231 | RequestInterface $request, |
| 232 | 232 | ResponseInterface $response, |
| 233 | 233 | $args |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (isset($config['languages'])) { |
| 66 | - $available_langs = array_filter($config['languages'], function ($config) { |
|
| 66 | + $available_langs = array_filter($config['languages'], function($config) { |
|
| 67 | 67 | return (!isset($config['active']) || $config['active']); |
| 68 | 68 | }); |
| 69 | 69 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public static function language_index() |
| 134 | 134 | { |
| 135 | 135 | if (!isset(self::$language_index)) { |
| 136 | - self::$language_index = new GenericConfig(__DIR__ . '/../../../../config/languages.json'); |
|
| 136 | + self::$language_index = new GenericConfig(__DIR__.'/../../../../config/languages.json'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return self::$language_index; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return void |
| 148 | 148 | * @throws InvalidArgumentException |
| 149 | 149 | */ |
| 150 | - public function resolve_ident(LanguageInterface &$lang, $ident = null) |
|
| 150 | + public function resolve_ident(LanguageInterface & $lang, $ident = null) |
|
| 151 | 151 | { |
| 152 | 152 | if (is_string($ident)) { |
| 153 | 153 | $lang->set_ident($ident); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | // If using PHP's built-in server, return false for existing files on filesystem |
| 12 | 12 | if (PHP_SAPI === 'cli-server') { |
| 13 | - $filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']); |
|
| 13 | + $filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']); |
|
| 14 | 14 | if (is_file($filename)) { |
| 15 | 15 | return false; |
| 16 | 16 | } |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | 35 | // Handle "404 Not Found" |
| 36 | -$container['notFoundHandler'] = function ($c) |
|
| 36 | +$container['notFoundHandler'] = function($c) |
|
| 37 | 37 | { |
| 38 | - return function ($request, $response) use ($c) |
|
| 38 | + return function($request, $response) use ($c) |
|
| 39 | 39 | { |
| 40 | 40 | return $c['response'] |
| 41 | 41 | ->withStatus(404) |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | 47 | // Handle "500 Server Error" |
| 48 | -$container['errorHandler'] = function ($c) |
|
| 48 | +$container['errorHandler'] = function($c) |
|
| 49 | 49 | { |
| 50 | - return function ($request, $response, $exception) use ($c) |
|
| 50 | + return function($request, $response, $exception) use ($c) |
|
| 51 | 51 | { |
| 52 | 52 | return $c['response'] |
| 53 | 53 | ->withStatus(500) |