| @@ -25,8 +25,7 @@ | ||
| 25 | 25 |  { | 
| 26 | 26 | $app = $container->get(Application::class); | 
| 27 | 27 | $app->execute(); | 
| 28 | -} | |
| 29 | -catch (\Exception $e) | |
| 28 | +} catch (\Exception $e) | |
| 30 | 29 |  { | 
| 31 | 30 | if (!headers_sent()) | 
| 32 | 31 |  	{ | 
| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -require dirname(__DIR__) . '/boot.php'; | |
| 3 | +require dirname(__DIR__).'/boot.php'; | |
| 4 | 4 | |
| 5 | 5 | use Joomla\Application\AbstractApplication; | 
| 6 | 6 | use Joomla\Application\AbstractWebApplication; | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | $container = (new Container) | 
| 18 | 18 | ->registerServiceProvider(new ApplicationServiceProvider) | 
| 19 | 19 | ->registerServiceProvider(new CacheServiceProvider) | 
| 20 | - ->registerServiceProvider(new ConfigServiceProvider(APPROOT . '/etc/config.json')) | |
| 20 | + ->registerServiceProvider(new ConfigServiceProvider(APPROOT.'/etc/config.json')) | |
| 21 | 21 | ->registerServiceProvider(new DatabaseServiceProvider) | 
| 22 | 22 | ->registerServiceProvider(new MonologServiceProvider); | 
| 23 | 23 | |
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | |
| 49 | 49 | $response = [ | 
| 50 | 50 | 'error' => true, | 
| 51 | - 'message' => 'An error occurred while executing the application: ' . $e->getMessage() | |
| 51 | + 'message' => 'An error occurred while executing the application: '.$e->getMessage() | |
| 52 | 52 | ]; | 
| 53 | 53 | |
| 54 | 54 | echo json_encode($response); | 
| @@ -53,7 +53,7 @@ | ||
| 53 | 53 |  	{ | 
| 54 | 54 | $container->share( | 
| 55 | 55 | 'config', | 
| 56 | - function () | |
| 56 | + function() | |
| 57 | 57 |  			{ | 
| 58 | 58 | return $this->config; | 
| 59 | 59 | }, | 
| @@ -72,15 +72,13 @@ | ||
| 72 | 72 | if ($this->cache->contains($key)) | 
| 73 | 73 |  			{ | 
| 74 | 74 | $body = $this->cache->fetch($key); | 
| 75 | - } | |
| 76 | - else | |
| 75 | + } else | |
| 77 | 76 |  			{ | 
| 78 | 77 | $body = $this->view->render(); | 
| 79 | 78 | |
| 80 | 79 |  				$this->cache->save($key, $body, $this->getApplication()->get('cache.lifetime', 900)); | 
| 81 | 80 | } | 
| 82 | - } | |
| 83 | - else | |
| 81 | + } else | |
| 84 | 82 |  		{ | 
| 85 | 83 | $body = $this->view->render(); | 
| 86 | 84 | } | 
| @@ -67,7 +67,7 @@ | ||
| 67 | 67 | // Serve cached data if the cache layer is enabled and the raw data source is not requested | 
| 68 | 68 |  		if ($this->getApplication()->get('cache.enabled', false) && !$authorizedRaw) | 
| 69 | 69 |  		{ | 
| 70 | - $key = md5(get_class($this->view) . __METHOD__ . $source); | |
| 70 | + $key = md5(get_class($this->view).__METHOD__.$source); | |
| 71 | 71 | |
| 72 | 72 | if ($this->cache->contains($key)) | 
| 73 | 73 |  			{ | 
| @@ -8,7 +8,6 @@ | ||
| 8 | 8 | use Monolog\Logger; | 
| 9 | 9 | use Monolog\Processor\PsrLogMessageProcessor; | 
| 10 | 10 | use Monolog\Processor\WebProcessor; | 
| 11 | -use Psr\Log\LoggerInterface; | |
| 12 | 11 | |
| 13 | 12 | /** | 
| 14 | 13 | * Monolog service provider | 
| @@ -31,7 +31,7 @@ discard block | ||
| 31 | 31 | // Register the PSR-3 processor | 
| 32 | 32 | $container->share( | 
| 33 | 33 | 'monolog.processor.psr3', | 
| 34 | - function () | |
| 34 | + function() | |
| 35 | 35 |  			{ | 
| 36 | 36 | return new PsrLogMessageProcessor; | 
| 37 | 37 | } | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | // Register the web processor | 
| 41 | 41 | $container->share( | 
| 42 | 42 | 'monolog.processor.web', | 
| 43 | - function () | |
| 43 | + function() | |
| 44 | 44 |  			{ | 
| 45 | 45 | return new WebProcessor; | 
| 46 | 46 | } | 
| @@ -49,7 +49,7 @@ discard block | ||
| 49 | 49 | // Register the web application handler | 
| 50 | 50 | $container->share( | 
| 51 | 51 | 'monolog.handler.application', | 
| 52 | - function (Container $container) | |
| 52 | + function(Container $container) | |
| 53 | 53 |  			{ | 
| 54 | 54 | /** @var \Joomla\Registry\Registry $config */ | 
| 55 | 55 |  				$config = $container->get('config'); | 
| @@ -57,8 +57,8 @@ discard block | ||
| 57 | 57 |  				$level = strtoupper($config->get('log.application', $config->get('log.level', 'error'))); | 
| 58 | 58 | |
| 59 | 59 | return new StreamHandler( | 
| 60 | - APPROOT . '/logs/stats.log', | |
| 61 | -					constant('\\Monolog\\Logger::' . $level) | |
| 60 | + APPROOT.'/logs/stats.log', | |
| 61 | +					constant('\\Monolog\\Logger::'.$level) | |
| 62 | 62 | ); | 
| 63 | 63 | } | 
| 64 | 64 | ); | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | // Register the database handler | 
| 67 | 67 | $container->share( | 
| 68 | 68 | 'monolog.handler.database', | 
| 69 | - function (Container $container) | |
| 69 | + function(Container $container) | |
| 70 | 70 |  			{ | 
| 71 | 71 | /** @var \Joomla\Registry\Registry $config */ | 
| 72 | 72 |  				$config = $container->get('config'); | 
| @@ -75,8 +75,8 @@ discard block | ||
| 75 | 75 |  				$level = $config->get('database.debug', false) ? 'DEBUG' : strtoupper($config->get('log.database', $config->get('log.level', 'error'))); | 
| 76 | 76 | |
| 77 | 77 | return new StreamHandler( | 
| 78 | - APPROOT . '/logs/stats.log', | |
| 79 | -					constant('\\Monolog\\Logger::' . $level) | |
| 78 | + APPROOT.'/logs/stats.log', | |
| 79 | +					constant('\\Monolog\\Logger::'.$level) | |
| 80 | 80 | ); | 
| 81 | 81 | } | 
| 82 | 82 | ); | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | // Register the web application Logger | 
| 85 | 85 | $container->share( | 
| 86 | 86 | 'monolog.logger.application', | 
| 87 | - function (Container $container) | |
| 87 | + function(Container $container) | |
| 88 | 88 |  			{ | 
| 89 | 89 | return new Logger( | 
| 90 | 90 | 'Application', | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 | // Register the CLI application Logger | 
| 102 | 102 | $container->share( | 
| 103 | 103 | 'monolog.logger.cli', | 
| 104 | - function (Container $container) | |
| 104 | + function(Container $container) | |
| 105 | 105 |  			{ | 
| 106 | 106 | return new Logger( | 
| 107 | 107 | 'Application', | 
| @@ -115,7 +115,7 @@ discard block | ||
| 115 | 115 | // Register the database Logger | 
| 116 | 116 | $container->share( | 
| 117 | 117 | 'monolog.logger.database', | 
| 118 | - function (Container $container) | |
| 118 | + function(Container $container) | |
| 119 | 119 |  			{ | 
| 120 | 120 | return new Logger( | 
| 121 | 121 | 'Database', | 
| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | |
| 3 | 3 | const APPROOT = __DIR__; | 
| 4 | 4 | |
| 5 | -$composerPath = APPROOT . '/vendor/autoload.php'; | |
| 5 | +$composerPath = APPROOT.'/vendor/autoload.php'; | |
| 6 | 6 | |
| 7 | 7 | if (!file_exists($composerPath)) | 
| 8 | 8 |  { | 
| 9 | 9 |  	throw new RuntimeException('Composer is not set up, please run "composer install".'); | 
| 10 | 10 | } | 
| 11 | 11 | |
| 12 | -require APPROOT . '/vendor/autoload.php'; | |
| 12 | +require APPROOT.'/vendor/autoload.php'; | |
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 |  		$container->alias('cache', CacheInterface::class) | 
| 29 | 29 | ->share( | 
| 30 | 30 | CacheInterface::class, | 
| 31 | - function (Container $container) | |
| 31 | + function(Container $container) | |
| 32 | 32 |  				{ | 
| 33 | 33 | /** @var \Joomla\Registry\Registry $config */ | 
| 34 | 34 |  					$config = $container->get('config'); | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | // If the path is relative, make it absolute | 
| 61 | 61 | if (substr($path, 0, 1) !== '/') | 
| 62 | 62 |  							{ | 
| 63 | - $path = APPROOT . '/' . $path; | |
| 63 | + $path = APPROOT.'/'.$path; | |
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | 66 | $handler = new Cache\FilesystemCache($path); | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | // If the path is relative, make it absolute | 
| 80 | 80 | if (substr($path, 0, 1) !== '/') | 
| 81 | 81 |  							{ | 
| 82 | - $path = APPROOT . '/' . $path; | |
| 82 | + $path = APPROOT.'/'.$path; | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | $handler = new Cache\PhpFileCache($path); | 
| @@ -91,11 +91,11 @@ | ||
| 91 | 91 | public function outputTitle($title, $subTitle = '', $width = 60) | 
| 92 | 92 |  	{ | 
| 93 | 93 |  		$this->out(str_repeat('-', $width)); | 
| 94 | -		$this->out(str_repeat(' ', $width / 2 - (strlen($title) / 2)) . '<title>' . $title . '</title>'); | |
| 94 | +		$this->out(str_repeat(' ', $width / 2 - (strlen($title) / 2)).'<title>'.$title.'</title>'); | |
| 95 | 95 | |
| 96 | 96 | if ($subTitle) | 
| 97 | 97 |  		{ | 
| 98 | -			$this->out(str_repeat(' ', $width / 2 - (strlen($subTitle) / 2)) . '<b>' . $subTitle . '</b>'); | |
| 98 | +			$this->out(str_repeat(' ', $width / 2 - (strlen($subTitle) / 2)).'<b>'.$subTitle.'</b>'); | |
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | 101 |  		$this->out(str_repeat('-', $width)); | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | /** | 
| 31 | 31 | * CliApplication constructor. | 
| 32 | 32 | * | 
| 33 | - * @param Input\Cli $input The application's input object. | |
| 33 | + * @param Cli $input The application's input object. | |
| 34 | 34 | * @param Registry $config The application's configuration. | 
| 35 | 35 | * @param CliOutput $output The application's output object. | 
| 36 | 36 | * @param CliInput $cliInput The application's CLI input handler. | 
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | protected function fetchController($name) | 
| 30 | 30 |  	{ | 
| 31 | 31 | // Derive the controller class name. | 
| 32 | - $class = $this->controllerPrefix . ucfirst($name); | |
| 32 | + $class = $this->controllerPrefix.ucfirst($name); | |
| 33 | 33 | |
| 34 | 34 | // If the controller class does not exist panic. | 
| 35 | 35 | if (!class_exists($class)) | 
| @@ -48,11 +48,11 @@ | ||
| 48 | 48 | |
| 49 | 49 | foreach ($this->getApplication()->getConsole()->getCommands() as $cName => $command) | 
| 50 | 50 |  		{ | 
| 51 | -			$this->getApplication()->out('<cmd>' . $cName . '</cmd>'); | |
| 51 | +			$this->getApplication()->out('<cmd>'.$cName.'</cmd>'); | |
| 52 | 52 | |
| 53 | 53 | if ($command->getDescription()) | 
| 54 | 54 |  			{ | 
| 55 | -				$this->getApplication()->out('    ' . $command->getDescription()); | |
| 55 | +				$this->getApplication()->out('    '.$command->getDescription()); | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | $this->getApplication()->out(); |