@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | if ($metric->isApplicable()) { |
59 | 59 | $lastValue = Memory::getInstance()->getLastData($metric->getName(), -1); |
60 | 60 | $currentValue = $metric->getValue($lastValue); |
61 | - if ($currentValue >= 0) Memory::getInstance()->addData($metric->getName(), $currentValue); |
|
61 | + if ($currentValue >= 0) { |
|
62 | + Memory::getInstance()->addData($metric->getName(), $currentValue); |
|
63 | + } |
|
62 | 64 | $metricResults[$metric->getName()] = max(0, $currentValue); |
63 | 65 | } |
64 | 66 | } |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | |
73 | 75 | $file = File::getInstance(); |
74 | 76 | |
75 | - if (!$file->fileExists('/proc/net/dev')) return 0; |
|
77 | + if (!$file->fileExists('/proc/net/dev')) { |
|
78 | + return 0; |
|
79 | + } |
|
76 | 80 | |
77 | 81 | $lines = $file->getContents('/proc/net/dev', true); |
78 | 82 | foreach ($lines as $line) { |
@@ -85,7 +89,9 @@ discard block |
||
85 | 89 | } |
86 | 90 | } |
87 | 91 | |
88 | - if (!isset($total)) return 0; |
|
92 | + if (!isset($total)) { |
|
93 | + return 0; |
|
94 | + } |
|
89 | 95 | |
90 | 96 | $history = $memory->getData(self::MEMORY_KEY) ?? []; |
91 | 97 |
@@ -66,7 +66,9 @@ |
||
66 | 66 | $progressBar->start(); |
67 | 67 | |
68 | 68 | foreach ($this->collectors as $collector) { |
69 | - if ($debugMode) $start = time(); |
|
69 | + if ($debugMode) { |
|
70 | + $start = time(); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | $progressBar->setMessage('collector: ' . $collector->getIdentifier()); |
72 | 74 | $progressBar->display(); |
@@ -32,7 +32,9 @@ |
||
32 | 32 | if ($fileHandler->isDir('/etc/logrotate.d')) { |
33 | 33 | $entries = $fileHandler->scanDir('/etc/logrotate.d'); |
34 | 34 | foreach ($entries as $entry) { |
35 | - if ($entry === '.' || $entry === '..') continue; |
|
35 | + if ($entry === '.' || $entry === '..') { |
|
36 | + continue; |
|
37 | + } |
|
36 | 38 | $fullPath = '/etc/logrotate.d/' . $entry; |
37 | 39 | $logrotateConfigurations[] = $fullPath; |
38 | 40 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | // Extract username, UID, and home directory |
31 | - [$username, , $uid, , , $homeDirectory] = array_slice($parts, 0, 6); |
|
31 | + [$username,, $uid,,, $homeDirectory] = array_slice($parts, 0, 6); |
|
32 | 32 | |
33 | 33 | // Only consider regular users (UID >= 1000) with a valid home directory |
34 | 34 | if (!$file->isDir($homeDirectory)) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $cmd = 'stat -c%s ' . $escaped; |
51 | 51 | } |
52 | 52 | |
53 | - $output =trim(Runner::getInstance()->run($cmd)->getOutput()); |
|
53 | + $output = trim(Runner::getInstance()->run($cmd)->getOutput()); |
|
54 | 54 | return is_numeric($output) ? (int)$output : 0; |
55 | 55 | } |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return trim(Runner::getInstance()->run($cmd)->getOutput()) === '1'; |
61 | 61 | } |
62 | 62 | |
63 | - public function getContents(string $path, bool $asArray = false): string|false|array |
|
63 | + public function getContents(string $path, bool $asArray = false): string | false | array |
|
64 | 64 | { |
65 | 65 | $cmd = 'cat ' . escapeshellarg($path) . ' 2>/dev/null'; |
66 | 66 | $output = Runner::getInstance()->run($cmd)->getOutput(); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | return explode("\n", trim($output)); |
81 | 81 | } |
82 | 82 | |
83 | - public function getFileContents(string $path, bool $asArray = false): string|false|array |
|
83 | + public function getFileContents(string $path, bool $asArray = false): string | false | array |
|
84 | 84 | { |
85 | 85 | return File::getInstance()->getContents($path, $asArray); |
86 | 86 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | { |
32 | 32 | $runner = Runner::getInstance(); |
33 | 33 | |
34 | - if(!$runner->commandExists('crontab')) { |
|
34 | + if (!$runner->commandExists('crontab')) { |
|
35 | 35 | return []; |
36 | 36 | } |
37 | 37 |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | $runner = new Runner(); |
24 | 24 | |
25 | - if (!$runner->commandExists('docker')) return []; |
|
25 | + if (!$runner->commandExists('docker')) { |
|
26 | + return []; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | $cmd = "docker ps --format '{{.ID}}|{{.Image}}|{{.Names}}|{{.Ports}}'"; |
28 | 30 | $output = Runner::getInstance()->run($cmd)->getOutput(); |
@@ -31,7 +33,9 @@ discard block |
||
31 | 33 | $containers = []; |
32 | 34 | |
33 | 35 | foreach ($lines as $line) { |
34 | - if (empty($line)) continue; |
|
36 | + if (empty($line)) { |
|
37 | + continue; |
|
38 | + } |
|
35 | 39 | |
36 | 40 | [$id, $image, $name, $ports] = explode('|', $line); |
37 | 41 | $containers[] = [ |
@@ -23,7 +23,9 @@ |
||
23 | 23 | { |
24 | 24 | if (!array_key_exists(ApacheServerNameCollector::COLLECTION_IDENTIFIER, $this->inventory) |
25 | 25 | || !is_array($this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]) |
26 | - ) return []; |
|
26 | + ) { |
|
27 | + return []; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $configs = $this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]; |
29 | 31 |