Completed
Push — main ( f1cf78...4d91e8 )
by mohsen
15s queued 13s
created
database/factories/ResourceLogFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 
12 12
     public function definition()
13 13
     {
14
-        $resources = ['cpu', 'memory', 'hardDisk', 'network', 'webServer'];
14
+        $resources = [ 'cpu', 'memory', 'hardDisk', 'network', 'webServer' ];
15 15
 
16 16
         return [
17
-            'resource' => $resources[random_int(0, 4)],
17
+            'resource' => $resources[ random_int(0, 4) ],
18 18
             'log' => $this->faker->text(),
19 19
         ];
20 20
     }
Please login to merge, or discard this patch.
routes/web.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 use Illuminate\Support\Facades\Route;
4 4
 use MohsenAbrishami\Stethoscope\Http\Controllers\MonitoringPanelController;
5 5
 
6
-Route::middleware(['check.access.to.monitoring.panel'])->group(function () {
6
+Route::middleware([ 'check.access.to.monitoring.panel' ])->group(function() {
7 7
     Route::get(
8 8
         config('stethoscope.monitoring_panel.path', 'monitoring-panel'),
9
-        [MonitoringPanelController::class, 'index']
9
+        [ MonitoringPanelController::class, 'index' ]
10 10
     )->name('monitoring-panel');
11 11
 });
Please login to merge, or discard this patch.
routes/api.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Illuminate\Support\Facades\Route;
4 4
 use MohsenAbrishami\Stethoscope\Http\Controllers\MonitorController;
5 5
 
6
-Route::middleware(['check.access.to.monitoring.panel'])->group(function () {
7
-    Route::get('monitor/current', [MonitorController::class, 'current']);
8
-    Route::get('monitor/history/{from}/{to}', [MonitorController::class, 'history']);
6
+Route::middleware([ 'check.access.to.monitoring.panel' ])->group(function() {
7
+    Route::get('monitor/current', [ MonitorController::class, 'current' ]);
8
+    Route::get('monitor/history/{from}/{to}', [ MonitorController::class, 'history' ]);
9 9
 });
Please login to merge, or discard this patch.
src/LogRecord/Drivers/FileDriver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,23 +19,23 @@
 block discarded – undo
19 19
 
20 20
     public function record($resourceLogs)
21 21
     {
22
-        $file = config('stethoscope.log_file_storage.path').now()->format('Y-m-d');
22
+        $file = config('stethoscope.log_file_storage.path') . now()->format('Y-m-d');
23 23
 
24 24
         $log = '';
25 25
 
26 26
         foreach ($resourceLogs as $resource => $report) {
27
-            $method = $resource.'Message';
27
+            $method = $resource . 'Message';
28 28
 
29 29
             if (method_exists($this, $method)) {
30
-                $log .= $this->$method($report)."\n";
30
+                $log .= $this->$method($report) . "\n";
31 31
             }
32 32
         }
33 33
 
34 34
         if ($log != '') {
35
-            $log = $this->timeMessage()."\n".$log;
35
+            $log = $this->timeMessage() . "\n" . $log;
36 36
 
37 37
             if ($this->storage->exists($file)) {
38
-                $log = $this->storage->get($file)."\n \n".$log;
38
+                $log = $this->storage->get($file) . "\n \n" . $log;
39 39
             }
40 40
 
41 41
             $this->storage->put($file, $log);
Please login to merge, or discard this patch.
src/Commands/MonitorCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 == 'false' && 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
     }
Please login to merge, or discard this patch.
src/Notifications/Notifiable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     use NotifiableTrait;
10 10
 
11
-    public function routeNotificationForMail(): string|array
11
+    public function routeNotificationForMail(): string | array
12 12
     {
13 13
         return config('stethoscope.notifications.mail.to');
14 14
     }
Please login to merge, or discard this patch.
src/Notifications/LogReportNotification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public function via($notifiable)
29 29
     {
30
-        $notificationChannels = config('stethoscope.notifications.notifications.'.static::class);
30
+        $notificationChannels = config('stethoscope.notifications.notifications.' . static::class);
31 31
 
32 32
         return array_filter($notificationChannels);
33 33
     }
Please login to merge, or discard this patch.
src/StethoscopeServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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('build'),
49
+                __DIR__ . '/../public/build' => public_path('build'),
50 50
             ], 'stethoscope-publish-view');
51 51
 
52 52
             $this->commands([
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Listeners/SendResourceLogNotification.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public function handle($resourceLogs)
8 8
     {
9
-        if (! is_null(config('stethoscope.notifications.notifiable'))) {
9
+        if (!is_null(config('stethoscope.notifications.notifiable'))) {
10 10
             $notifiable = app(config('stethoscope.notifications.notifiable'));
11 11
 
12 12
             $notificationClass = $this->detemineNotificationClass();
@@ -21,6 +21,6 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $notifications = config('stethoscope.notifications.notifications');
23 23
 
24
-        return array_keys($notifications)[0];
24
+        return array_keys($notifications)[ 0 ];
25 25
     }
26 26
 }
Please login to merge, or discard this patch.