Passed
Pull Request — main (#83)
by
unknown
10:57
created
src/Traits/MessageCreatorTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     public function hardDiskMessage(string $name, int $hardDiskUsage)
35 35
     {
36 36
         return "hard disk {$name} free space ===> $hardDiskUsage Byte (" .
37
-            number_format($hardDiskUsage / 1024 / 1024 / 1024, 2, '.', '') .  ' GB)';
37
+            number_format($hardDiskUsage / 1024 / 1024 / 1024, 2, '.', '') . ' GB)';
38 38
     }
39 39
 
40 40
     /**
Please login to merge, or discard this patch.
src/Commands/MonitorCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,34 +46,34 @@
 block discarded – undo
46 46
      */
47 47
     public function handle()
48 48
     {
49
-        $resourceReports = [];
49
+        $resourceReports = [ ];
50 50
 
51 51
         $cpuUsage = $this->cpu->check();
52 52
         $memoryUsage = $this->memory->check();
53 53
         $networkStatus = $this->network->check();
54
-        foreach(config("stethoscope.hard_disks") as $name => ["path" => $path, "threshold" => $threshold]){
54
+        foreach (config("stethoscope.hard_disks") as $name => [ "path" => $path, "threshold" => $threshold ]) {
55 55
             $hardDiskFreeSpace = $this->hardDisk->check($path);
56
-            if ($hardDiskFreeSpace < $threshold && config('stethoscope.monitorable_resources.hard_disk')){
57
-                $resourceReports['hardDisk'][$name] = $hardDiskFreeSpace;
56
+            if ($hardDiskFreeSpace < $threshold && config('stethoscope.monitorable_resources.hard_disk')) {
57
+                $resourceReports[ 'hardDisk' ][ $name ] = $hardDiskFreeSpace;
58 58
             }
59 59
         }
60 60
 
61 61
         $webServerStatuses = $this->webServer->check();
62 62
 
63
-        if (config('stethoscope.monitorable_resources.cpu') && $cpuUsage > config(('stethoscope.thresholds.cpu'))){
64
-            $resourceReports['cpu'] = $cpuUsage;
63
+        if (config('stethoscope.monitorable_resources.cpu') && $cpuUsage > config(('stethoscope.thresholds.cpu'))) {
64
+            $resourceReports[ 'cpu' ] = $cpuUsage;
65 65
         }
66 66
 
67
-        if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')){
68
-            $resourceReports['memory'] = $memoryUsage;
67
+        if ($memoryUsage > config(('stethoscope.thresholds.memory')) && config('stethoscope.monitorable_resources.memory')) {
68
+            $resourceReports[ 'memory' ] = $memoryUsage;
69 69
         }
70 70
 
71
-        if ($networkStatus == 'false' && config('stethoscope.monitorable_resources.network')){
72
-            $resourceReports['network'] = $networkStatus;
71
+        if ($networkStatus == 'false' && config('stethoscope.monitorable_resources.network')) {
72
+            $resourceReports[ 'network' ] = $networkStatus;
73 73
         }
74 74
 
75
-        if ($webServerStatuses != 'active' && config('stethoscope.monitorable_resources.web_server')){
76
-            $resourceReports['webServer'] = $webServerStatuses;
75
+        if ($webServerStatuses != 'active' && config('stethoscope.monitorable_resources.web_server')) {
76
+            $resourceReports[ 'webServer' ] = $webServerStatuses;
77 77
         }
78 78
 
79 79
         Record::record($resourceReports);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,8 @@
 block discarded – undo
78 78
 
79 79
         Record::record($resourceReports);
80 80
 
81
-        if (!empty($resourceReports))
82
-            TroubleOccurred::dispatch($resourceReports);
81
+        if (!empty($resourceReports)) {
82
+                    TroubleOccurred::dispatch($resourceReports);
83
+        }
83 84
     }
84 85
 }
Please login to merge, or discard this patch.
src/Commands/ListenCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     use MessageCreatorTrait;
17 17
 
18
-    public function __construct(private Cpu $cpu,private  Memory $memory,private  Network $network,private  WebServer $webServer,private  HardDisk $hardDisk)
18
+    public function __construct(private Cpu $cpu, private  Memory $memory, private  Network $network, private  WebServer $webServer, private  HardDisk $hardDisk)
19 19
     {
20 20
         parent::__construct();
21 21
 
@@ -58,26 +58,26 @@  discard block
 block discarded – undo
58 58
             );
59 59
         }
60 60
 
61
-        if ($resources->contains('memory')  || $resourcesIsEmpty) {
61
+        if ($resources->contains('memory') || $resourcesIsEmpty) {
62 62
             $this->info(
63 63
                 $this->memoryMessage($this->memory->check())
64 64
             );
65 65
         }
66 66
 
67
-        if ($resources->contains('network')  || $resourcesIsEmpty) {
67
+        if ($resources->contains('network') || $resourcesIsEmpty) {
68 68
             $this->info(
69 69
                 $this->networkMessage($this->network->check())
70 70
             );
71 71
         }
72 72
 
73
-        if ($resources->contains('web-server')  || $resourcesIsEmpty) {
73
+        if ($resources->contains('web-server') || $resourcesIsEmpty) {
74 74
             $this->info(
75 75
                 $this->webServerMessage($this->webServer->check())
76 76
             );
77 77
         }
78 78
 
79 79
         if ($resources->contains('hdd') || $resourcesIsEmpty) {
80
-            foreach(config("stethoscope.hard_disks") as $name => ["path" => $path, "threshold" => $threshold]){
80
+            foreach (config("stethoscope.hard_disks") as $name => [ "path" => $path, "threshold" => $threshold ]) {
81 81
                 $this->info(
82 82
                     $this->hardDiskMessage($name, $this->hardDisk->check($path))
83 83
                 );
Please login to merge, or discard this patch.