@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function handle($request, Closure $next) |
10 | 10 | { |
11 | - if (! config('stethoscope.monitoring_panel.status')) { |
|
11 | + if (!config('stethoscope.monitoring_panel.status')) { |
|
12 | 12 | abort(404); |
13 | 13 | } |
14 | 14 |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | |
27 | 27 | public function history($from, $to) |
28 | 28 | { |
29 | - $resourceLogs = ResourceLog::where('created_at', '>=', $from.' 00:00:00') |
|
30 | - ->where('created_at', '<=', $to.' 23:59:59') |
|
29 | + $resourceLogs = ResourceLog::where('created_at', '>=', $from . ' 00:00:00') |
|
30 | + ->where('created_at', '<=', $to . ' 23:59:59') |
|
31 | 31 | ->select(DB::raw('date(created_at) as date'), 'resource') |
32 | 32 | ->get(); |
33 | 33 | |
34 | - $labels = []; |
|
34 | + $labels = [ ]; |
|
35 | 35 | foreach (CarbonPeriod::create($from, $to) as $date) { |
36 | 36 | array_push($labels, $date->format('Y-m-d')); |
37 | 37 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function resourceLogCount($resource, $labels, $resourceLogs) |
52 | 52 | { |
53 | - $logCount = []; |
|
53 | + $logCount = [ ]; |
|
54 | 54 | foreach ($labels as $label) { |
55 | - $resourceCount = $resourceLogs->countBy(function ($resourceLogs) use ($resource, $label) { |
|
56 | - return $resourceLogs['resource'] == $resource && $resourceLogs['date'] == $label; |
|
55 | + $resourceCount = $resourceLogs->countBy(function($resourceLogs) use ($resource, $label) { |
|
56 | + return $resourceLogs[ 'resource' ] == $resource && $resourceLogs[ 'date' ] == $label; |
|
57 | 57 | }); |
58 | - array_push($logCount, count($resourceCount) > 1 ? $resourceCount[1] : 0); |
|
58 | + array_push($logCount, count($resourceCount) > 1 ? $resourceCount[ 1 ] : 0); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $logCount; |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function register() |
21 | 21 | { |
22 | - $this->app->singleton('record', function ($app) { |
|
22 | + $this->app->singleton('record', function($app) { |
|
23 | 23 | return new LogManager($app); |
24 | 24 | }); |
25 | 25 | |
26 | 26 | $this->mergeConfigFrom( |
27 | - __DIR__.'/../config/stethoscope.php', |
|
27 | + __DIR__ . '/../config/stethoscope.php', |
|
28 | 28 | 'stethoscope' |
29 | 29 | ); |
30 | 30 | |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | if ($this->app->runningInConsole()) { |
42 | 42 | // publishing the config |
43 | 43 | $this->publishes([ |
44 | - __DIR__.'/../config/stethoscope.php' => config_path('stethoscope.php'), |
|
44 | + __DIR__ . '/../config/stethoscope.php' => config_path('stethoscope.php'), |
|
45 | 45 | ], 'stethoscope-publish-config'); |
46 | 46 | |
47 | 47 | // publishing the build files |
48 | 48 | $this->publishes([ |
49 | - __DIR__.'/../public/build' => public_path('vendor/stethoscope'), |
|
49 | + __DIR__ . '/../public/build' => public_path('vendor/stethoscope'), |
|
50 | 50 | ], 'stethoscope-publish-view'); |
51 | 51 | |
52 | 52 | $this->commands([ |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | ]); |
57 | 57 | } |
58 | 58 | |
59 | - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
59 | + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
60 | 60 | |
61 | - $this->loadRoutesFrom(__DIR__.'/../routes/api.php'); |
|
62 | - $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
|
61 | + $this->loadRoutesFrom(__DIR__ . '/../routes/api.php'); |
|
62 | + $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
|
63 | 63 | |
64 | - $this->loadViewsFrom(__DIR__.'/../resources/views', 'mohsenabrishami'); |
|
64 | + $this->loadViewsFrom(__DIR__ . '/../resources/views', 'mohsenabrishami'); |
|
65 | 65 | |
66 | - $this->app['router']->aliasMiddleware('check.access.to.monitoring.panel', CheckAccessToMonitoringPanel::class); |
|
66 | + $this->app[ 'router' ]->aliasMiddleware('check.access.to.monitoring.panel', CheckAccessToMonitoringPanel::class); |
|
67 | 67 | } |
68 | 68 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function handle() |
47 | 47 | { |
48 | - $resourceReports = []; |
|
48 | + $resourceReports = [ ]; |
|
49 | 49 | |
50 | 50 | $cpuUsage = $this->cpu->check(); |
51 | 51 | $memoryUsage = $this->memory->check(); |
@@ -54,28 +54,28 @@ discard block |
||
54 | 54 | $webServerStatuses = $this->webServer->check(); |
55 | 55 | |
56 | 56 | if (config('stethoscope.monitorable_resources.cpu') && $cpuUsage > config(('stethoscope.thresholds.cpu'))) { |
57 | - $resourceReports['cpu'] = $cpuUsage; |
|
57 | + $resourceReports[ 'cpu' ] = $cpuUsage; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')) { |
61 | - $resourceReports['memory'] = $memoryUsage; |
|
61 | + $resourceReports[ 'memory' ] = $memoryUsage; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | if ($networkStatus == 'disconnected' && config('stethoscope.monitorable_resources.network')) { |
65 | - $resourceReports['network'] = $networkStatus; |
|
65 | + $resourceReports[ 'network' ] = $networkStatus; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($hardDiskFreeSpace < config(('stethoscope.thresholds.hard_disk')) && config('stethoscope.monitorable_resources.hard_disk')) { |
69 | - $resourceReports['hardDisk'] = $hardDiskFreeSpace; |
|
69 | + $resourceReports[ 'hardDisk' ] = $hardDiskFreeSpace; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($webServerStatuses != 'active' && config('stethoscope.monitorable_resources.web_server')) { |
73 | - $resourceReports['webServer'] = $webServerStatuses; |
|
73 | + $resourceReports[ 'webServer' ] = $webServerStatuses; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | Record::record($resourceReports); |
77 | 77 | |
78 | - if (! empty($resourceReports)) { |
|
78 | + if (!empty($resourceReports)) { |
|
79 | 79 | TroubleOccurred::dispatch($resourceReports); |
80 | 80 | } |
81 | 81 | } |
@@ -66,6 +66,6 @@ |
||
66 | 66 | */ |
67 | 67 | public function webServerMessage($webServerStatus) |
68 | 68 | { |
69 | - return 'web server status ===> '.$webServerStatus; |
|
69 | + return 'web server status ===> ' . $webServerStatus; |
|
70 | 70 | } |
71 | 71 | } |