@@ -26,14 +26,18 @@ |
||
26 | 26 | { |
27 | 27 | $runner = Runner::getInstance(); |
28 | 28 | |
29 | - if (!$runner->fileExists(self::INI_FILE)) return []; |
|
29 | + if (!$runner->fileExists(self::INI_FILE)) { |
|
30 | + return []; |
|
31 | + } |
|
30 | 32 | |
31 | 33 | $config = $runner->getFileContents(self::INI_FILE, true); |
32 | 34 | |
33 | 35 | $configArray = []; |
34 | 36 | |
35 | 37 | foreach ($config as $line) { |
36 | - if (str_starts_with($line, '[')) continue; |
|
38 | + if (str_starts_with($line, '[')) { |
|
39 | + continue; |
|
40 | + } |
|
37 | 41 | $element = explode('=', $line); |
38 | 42 | $configArray[$element[0]] = trim($element[1]); |
39 | 43 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | return explode("\n", trim($output)); |
60 | 60 | } |
61 | 61 | |
62 | - public function getFileContents(string $path, bool $asArray = false): string|false|array |
|
62 | + public function getFileContents(string $path, bool $asArray = false): string | false | array |
|
63 | 63 | { |
64 | 64 | if ($asArray) { |
65 | 65 | return file($path); |
@@ -75,7 +75,9 @@ |
||
75 | 75 | $collector->setClient($client); |
76 | 76 | } |
77 | 77 | |
78 | - if ($debugMode) $start = time(); |
|
78 | + if ($debugMode) { |
|
79 | + $start = time(); |
|
80 | + } |
|
79 | 81 | $collected = $collector->collect(); |
80 | 82 | if ($collected) { |
81 | 83 | $inventory[$collector->getIdentifier()] = $collected; |
@@ -124,13 +124,17 @@ |
||
124 | 124 | $command = "systemctl list-units --type=service --all --no-legend --no-pager | awk '{printf \"%s|%s|%s|%s|\", \$1, \$2, \$3, \$4; for (i=5; i<=NF; i++) printf \$i \" \"; print \"\"}'"; |
125 | 125 | |
126 | 126 | $output = shell_exec($command); |
127 | - if ($output === null) return []; |
|
127 | + if ($output === null) { |
|
128 | + return []; |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $lines = explode("\n", trim($output)); |
130 | 132 | $services = []; |
131 | 133 | |
132 | 134 | foreach ($lines as $line) { |
133 | - if (empty($line)) continue; |
|
135 | + if (empty($line)) { |
|
136 | + continue; |
|
137 | + } |
|
134 | 138 | $parts = explode('|', $line); |
135 | 139 | |
136 | 140 | if (count($parts) >= 5) { |