@@ -46,7 +46,7 @@ |
||
46 | 46 | $serverName = $io->ask( |
47 | 47 | 'Please provide the name of the server (default: ' . $defaultName . ')', |
48 | 48 | $defaultName, |
49 | - function (?string $value) { |
|
49 | + function(?string $value) { |
|
50 | 50 | if (strlen($value ?? '') < 3) { |
51 | 51 | throw new \RuntimeException('The server name has to be at least three characters long.'); |
52 | 52 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | } elseif ($os === 'Linux') { |
53 | 53 | $memInfo = file_get_contents("/proc/meminfo"); |
54 | 54 | preg_match("/MemTotal:\s+(\d+)\skB/", $memInfo, $matches); |
55 | - return isset($matches[1]) ? round((float)$matches[1] / 1024, 2) :0; |
|
55 | + return isset($matches[1]) ? round((float)$matches[1] / 1024, 2) : 0; |
|
56 | 56 | } |
57 | 57 | return 0; |
58 | 58 | } |
@@ -44,7 +44,9 @@ |
||
44 | 44 | $packages = []; |
45 | 45 | |
46 | 46 | foreach ($lines as $line) { |
47 | - if (trim($line) === '') continue; |
|
47 | + if (trim($line) === '') { |
|
48 | + continue; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | if (preg_match('/^([^\s\/]+)\/[^\s]+\s+([^\s]+).*upgradable from: ([^\]]+)/', $line, $matches)) { |
50 | 52 | $packages[$matches[1]] = [ |
@@ -23,14 +23,18 @@ |
||
23 | 23 | */ |
24 | 24 | public function collect(): array |
25 | 25 | { |
26 | - if (!file_exists(self::INI_FILE)) return []; |
|
26 | + if (!file_exists(self::INI_FILE)) { |
|
27 | + return []; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $config = file(self::INI_FILE); |
29 | 31 | |
30 | 32 | $configArray = []; |
31 | 33 | |
32 | 34 | foreach ($config as $line) { |
33 | - if (str_starts_with($line, '[')) continue; |
|
35 | + if (str_starts_with($line, '[')) { |
|
36 | + continue; |
|
37 | + } |
|
34 | 38 | $element = explode('=', $line); |
35 | 39 | $configArray[$element[0]] = trim($element[1]); |
36 | 40 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $config['remote'] = $isEnabled; |
81 | 81 | |
82 | - file_put_contents($this->getConfigFile(), json_encode($config), JSON_PRETTY_PRINT);; |
|
82 | + file_put_contents($this->getConfigFile(), json_encode($config), JSON_PRETTY_PRINT); ; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function setLogfileEnabled(bool $isEnabled): void |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $config['logfile'] = $isEnabled; |
94 | 94 | |
95 | - file_put_contents($this->getConfigFile(), json_encode($config), JSON_PRETTY_PRINT);; |
|
95 | + file_put_contents($this->getConfigFile(), json_encode($config), JSON_PRETTY_PRINT); ; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -84,7 +84,9 @@ |
||
84 | 84 | |
85 | 85 | foreach ($lines as $line) { |
86 | 86 | $line = trim(preg_replace('/#.*/', '', $line)); // Kommentare entfernen |
87 | - if ($line === '') continue; |
|
87 | + if ($line === '') { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | if (preg_match('/^\s*(\w+)\s+(yes|no)\s*$/i', $line, $matches)) { |
90 | 92 | $key = strtolower($matches[1]); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | // Extract username, UID, and home directory |
28 | - [$username, , $uid, , , $homeDirectory] = array_slice($parts, 0, 6); |
|
28 | + [$username,, $uid,,, $homeDirectory] = array_slice($parts, 0, 6); |
|
29 | 29 | |
30 | 30 | // Only consider regular users (UID >= 1000) with a valid home directory |
31 | 31 | if (!is_dir($homeDirectory)) { |
@@ -43,7 +43,9 @@ |
||
43 | 43 | // Step 2: Extract managed log paths from logrotate config files |
44 | 44 | $explicitManaged = []; |
45 | 45 | foreach ($logrotateConfs as $confFile) { |
46 | - if (!is_readable($confFile)) continue; |
|
46 | + if (!is_readable($confFile)) { |
|
47 | + continue; |
|
48 | + } |
|
47 | 49 | $lines = file($confFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
48 | 50 | foreach ($lines as $line) { |
49 | 51 | if (preg_match('#^\s*/[^\s{}]+\.log#', $line, $matches)) { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | private function parseListeningPorts(): array |
51 | 51 | { |
52 | 52 | $output = []; |
53 | - exec("ss -tuln", $output); // TCP und UDP, listening, numerisch |
|
53 | + exec("ss -tuln", $output); // TCP und UDP, listening, numerisch |
|
54 | 54 | |
55 | 55 | $ports = []; |
56 | 56 |