@@ -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); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $container->alias('db', DatabaseDriver::class) |
28 | 28 | ->share( |
29 | 29 | DatabaseDriver::class, |
30 | - function (Container $container) |
|
30 | + function(Container $container) |
|
31 | 31 | { |
32 | 32 | $config = $container->get('config'); |
33 | 33 |
@@ -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 | { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * CliApplication constructor. |
31 | 31 | * |
32 | - * @param Input\Cli $input The application's input object. |
|
32 | + * @param Cli $input The application's input object. |
|
33 | 33 | * @param Registry $config The application's configuration. |
34 | 34 | * @param CliOutput $output The application's output object. |
35 | 35 | * @param Console $console The application's console object. |
@@ -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)); |
@@ -2,9 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Stats; |
4 | 4 | |
5 | -use Joomla\Application\Cli\ColorStyle; |
|
6 | -use Joomla\Application\Cli\Output\Processor\ColorProcessor; |
|
7 | -use Joomla\Controller\AbstractController; |
|
8 | 5 | use Joomla\DI\ContainerAwareInterface; |
9 | 6 | use Joomla\DI\ContainerAwareTrait; |
10 | 7 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $commands = []; |
56 | 56 | |
57 | 57 | /** @var \DirectoryIterator $fileInfo */ |
58 | - foreach (new \DirectoryIterator(__DIR__ . '/Commands') as $fileInfo) |
|
58 | + foreach (new \DirectoryIterator(__DIR__.'/Commands') as $fileInfo) |
|
59 | 59 | { |
60 | 60 | if ($fileInfo->isDot() || !$fileInfo->isFile()) |
61 | 61 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $command = $fileInfo->getBasename('.php'); |
66 | - $className = __NAMESPACE__ . "\\Commands\\$command"; |
|
66 | + $className = __NAMESPACE__."\\Commands\\$command"; |
|
67 | 67 | |
68 | 68 | if (false == class_exists($className)) |
69 | 69 | { |
@@ -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', |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $container->alias(CliApplication::class, JoomlaApplication\AbstractCliApplication::class) |
43 | 43 | ->share( |
44 | 44 | JoomlaApplication\AbstractCliApplication::class, |
45 | - function (Container $container) |
|
45 | + function(Container $container) |
|
46 | 46 | { |
47 | 47 | $application = new CliApplication( |
48 | 48 | $container->get(Cli::class), |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $container->alias(WebApplication::class, JoomlaApplication\AbstractWebApplication::class) |
64 | 64 | ->share( |
65 | 65 | JoomlaApplication\AbstractWebApplication::class, |
66 | - function (Container $container) |
|
66 | + function(Container $container) |
|
67 | 67 | { |
68 | 68 | $application = new WebApplication($container->get(Input::class), $container->get('config')); |
69 | 69 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $container->share( |
80 | 80 | Input::class, |
81 | - function () |
|
81 | + function() |
|
82 | 82 | { |
83 | 83 | return new Input($_REQUEST); |
84 | 84 | }, |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $container->share( |
89 | 89 | Cli::class, |
90 | - function () |
|
90 | + function() |
|
91 | 91 | { |
92 | 92 | return new Cli; |
93 | 93 | }, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $container->share( |
98 | 98 | Console::class, |
99 | - function (Container $container) |
|
99 | + function(Container $container) |
|
100 | 100 | { |
101 | 101 | $console = new Console; |
102 | 102 | $console->setContainer($container); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $container->share( |
109 | 109 | JoomlaApplication\Cli\Output\Processor\ColorProcessor::class, |
110 | - function (Container $container) |
|
110 | + function(Container $container) |
|
111 | 111 | { |
112 | 112 | $processor = new JoomlaApplication\Cli\Output\Processor\ColorProcessor; |
113 | 113 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $container->alias(JoomlaApplication\Cli\CliOutput::class, JoomlaApplication\Cli\Output\Stdout::class) |
130 | 130 | ->share( |
131 | 131 | JoomlaApplication\Cli\Output\Stdout::class, |
132 | - function (Container $container) |
|
132 | + function(Container $container) |
|
133 | 133 | { |
134 | 134 | return new JoomlaApplication\Cli\Output\Stdout($container->get(JoomlaApplication\Cli\Output\Processor\ColorProcessor::class)); |
135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $container->share( |
139 | 139 | Router::class, |
140 | - function (Container $container) |
|
140 | + function(Container $container) |
|
141 | 141 | { |
142 | 142 | $router = (new Router($container->get(Input::class))) |
143 | 143 | ->setContainer($container) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $container->share( |
155 | 155 | HelpCommand::class, |
156 | - function (Container $container) |
|
156 | + function(Container $container) |
|
157 | 157 | { |
158 | 158 | $command = new HelpCommand; |
159 | 159 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | $container->share( |
169 | 169 | SnapshotCommand::class, |
170 | - function (Container $container) |
|
170 | + function(Container $container) |
|
171 | 171 | { |
172 | 172 | $command = new SnapshotCommand($container->get(StatsJsonView::class)); |
173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $container->share( |
183 | 183 | DisplayControllerGet::class, |
184 | - function (Container $container) |
|
184 | + function(Container $container) |
|
185 | 185 | { |
186 | 186 | $controller = new DisplayControllerGet( |
187 | 187 | $container->get(StatsJsonView::class), |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $container->share( |
200 | 200 | SubmitControllerCreate::class, |
201 | - function (Container $container) |
|
201 | + function(Container $container) |
|
202 | 202 | { |
203 | 203 | $controller = new SubmitControllerCreate( |
204 | 204 | $container->get(StatsModel::class) |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $container->share( |
216 | 216 | SubmitControllerGet::class, |
217 | - function (Container $container) |
|
217 | + function(Container $container) |
|
218 | 218 | { |
219 | 219 | $controller = new SubmitControllerGet; |
220 | 220 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | $container->share( |
230 | 230 | StatsModel::class, |
231 | - function (Container $container) |
|
231 | + function(Container $container) |
|
232 | 232 | { |
233 | 233 | return new StatsModel( |
234 | 234 | $container->get(DatabaseDriver::class) |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $container->share( |
241 | 241 | StatsJsonView::class, |
242 | - function (Container $container) |
|
242 | + function(Container $container) |
|
243 | 243 | { |
244 | 244 | return new StatsJsonView( |
245 | 245 | $container->get(StatsModel::class) |
@@ -40,8 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $controller = $this->router->getController($this->get('uri.route')); |
42 | 42 | $controller->execute(); |
43 | - } |
|
44 | - catch (\Exception $e) |
|
43 | + } catch (\Exception $e) |
|
45 | 44 | { |
46 | 45 | // Log the error for reference |
47 | 46 | $this->getLogger()->error( |