Completed
Push — main ( 4c158d...f0eec3 )
by mohsen
16s queued 14s
created
src/Http/Controllers/MonitorController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function history($from, $to)
28 28
     {
29
-        $logs = ResourceLog::where('created_at', '>=', $from.' 00:00:00')
30
-            ->where('created_at', '<=', $to.' 23:59:59')
29
+        $logs = 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
 block discarded – undo
50 50
 
51 51
     protected function resourceLogCount($resource, $labels, $logs)
52 52
     {
53
-        $logCount = [];
53
+        $logCount = [ ];
54 54
         foreach ($labels as $label) {
55
-            $resourceCount = $logs->countBy(function ($logs) use ($resource, $label) {
56
-                return $logs['resource'] == $resource && $logs['date'] == $label;
55
+            $resourceCount = $logs->countBy(function($logs) use ($resource, $label) {
56
+                return $logs[ 'resource' ] == $resource && $logs[ '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;
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($logs)
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.
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($logs)
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 ($logs 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   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function handle()
47 47
     {
48
-        $logs = [];
49
-        $logs['signature'] = $this->signature;
48
+        $logs = [ ];
49
+        $logs[ 'signature' ] = $this->signature;
50 50
 
51 51
         $cpuUsage = $this->cpu->check();
52 52
         $memoryUsage = $this->memory->check();
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
         $webServerStatuses = $this->webServer->check();
56 56
 
57 57
         if (config('stethoscope.monitorable_resources.cpu') && $cpuUsage > config(('stethoscope.thresholds.cpu'))) {
58
-            $logs['cpu'] = $cpuUsage;
58
+            $logs[ 'cpu' ] = $cpuUsage;
59 59
         }
60 60
 
61 61
         if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')) {
62
-            $logs['memory'] = $memoryUsage;
62
+            $logs[ 'memory' ] = $memoryUsage;
63 63
         }
64 64
 
65 65
         if ($networkStatus == 'disconnected' && config('stethoscope.monitorable_resources.network')) {
66
-            $logs['network'] = $networkStatus;
66
+            $logs[ 'network' ] = $networkStatus;
67 67
         }
68 68
 
69 69
         if ($storageFreeSpace < config(('stethoscope.thresholds.storage')) && config('stethoscope.monitorable_resources.storage')) {
70
-            $logs['storage'] = $storageFreeSpace;
70
+            $logs[ 'storage' ] = $storageFreeSpace;
71 71
         }
72 72
 
73 73
         if ($webServerStatuses != 'active' && config('stethoscope.monitorable_resources.web_server')) {
74
-            $logs['webServer'] = $webServerStatuses;
74
+            $logs[ 'webServer' ] = $webServerStatuses;
75 75
         }
76 76
 
77 77
         Record::record($logs);
78 78
 
79
-        if (! empty($logs)) {
79
+        if (!empty($logs)) {
80 80
             TroubleOccurred::dispatch($logs);
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
src/Commands/ListenCommand.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,49 +54,49 @@
 block discarded – undo
54 54
 
55 55
         $resourcesIsEmpty = $resources->isEmpty();
56 56
 
57
-        $logs = [];
58
-        $logs['signature'] = $this->signature;
57
+        $logs = [ ];
58
+        $logs[ 'signature' ] = $this->signature;
59 59
 
60 60
         $this->line(
61 61
             $this->timeMessage()
62 62
         );
63 63
 
64 64
         if ($resources->contains('cpu') || $resourcesIsEmpty) {
65
-            $logs['cpu'] = $this->cpu->check();
65
+            $logs[ 'cpu' ] = $this->cpu->check();
66 66
             $this->info(
67
-                $this->cpuMessage($logs['cpu'])
67
+                $this->cpuMessage($logs[ 'cpu' ])
68 68
             );
69 69
         }
70 70
 
71 71
         if ($resources->contains('memory') || $resourcesIsEmpty) {
72
-            $logs['memory'] = $this->memory->check();
72
+            $logs[ 'memory' ] = $this->memory->check();
73 73
             $this->info(
74
-                $this->memoryMessage($logs['memory'])
74
+                $this->memoryMessage($logs[ 'memory' ])
75 75
             );
76 76
         }
77 77
 
78 78
         if ($resources->contains('network') || $resourcesIsEmpty) {
79
-            $logs['network'] = $this->network->check();
79
+            $logs[ 'network' ] = $this->network->check();
80 80
             $this->info(
81
-                $this->networkMessage($logs['network'])
81
+                $this->networkMessage($logs[ 'network' ])
82 82
             );
83 83
         }
84 84
 
85 85
         if ($resources->contains('web-server') || $resourcesIsEmpty) {
86
-            $logs['webServer'] = $this->webServer->check();
86
+            $logs[ 'webServer' ] = $this->webServer->check();
87 87
             $this->info(
88
-                $this->webServerMessage($logs['webServer'])
88
+                $this->webServerMessage($logs[ 'webServer' ])
89 89
             );
90 90
         }
91 91
 
92 92
         if ($resources->contains('storage') || $resourcesIsEmpty) {
93
-            $logs['storage'] = $this->storageService->check();
93
+            $logs[ 'storage' ] = $this->storageService->check();
94 94
             $this->info(
95
-                $this->storageMessage($logs['storage'])
95
+                $this->storageMessage($logs[ 'storage' ])
96 96
             );
97 97
         }
98 98
         
99
-        if ($this->option('notif')){
99
+        if ($this->option('notif')) {
100 100
             TroubleOccurred::dispatch($logs);
101 101
         }
102 102
     }
Please login to merge, or discard this patch.
config/stethoscope.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     |
73 73
     */
74 74
 
75
-    'network_monitor_url' => env('NETWORK_MONITOR_URL', ['https://1.1.1.1', 'https://www.google.com']),
75
+    'network_monitor_url' => env('NETWORK_MONITOR_URL', [ 'https://1.1.1.1', 'https://www.google.com' ]),
76 76
 
77 77
     /*
78 78
     |--------------------------------------------------------------------------
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     'notifications' => [
108 108
 
109 109
         'notifications' => [
110
-            \MohsenAbrishami\Stethoscope\Notifications\LogReportNotification::class => ['mail'],
110
+            \MohsenAbrishami\Stethoscope\Notifications\LogReportNotification::class => [ 'mail' ],
111 111
         ],
112 112
 
113 113
         'notifiable' => \MohsenAbrishami\Stethoscope\Notifications\Notifiable::class,
Please login to merge, or discard this patch.