@@ -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]] = [ |
@@ -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)) { |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | { |
22 | 22 | if (!array_key_exists(ApacheServerNameCollector::COLLECTION_IDENTIFIER, $this->inventory) |
23 | 23 | || !is_array($this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]) |
24 | - ) return []; |
|
24 | + ) { |
|
25 | + return []; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $configs = $this->inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]; |
27 | 29 | |
@@ -51,7 +53,9 @@ discard block |
||
51 | 53 | private function extractPlugins(string $documentRoot): array |
52 | 54 | { |
53 | 55 | $pluginDir = $documentRoot . 'wp-content/plugins'; |
54 | - if (!is_dir($pluginDir)) return []; |
|
56 | + if (!is_dir($pluginDir)) { |
|
57 | + return []; |
|
58 | + } |
|
55 | 59 | |
56 | 60 | $plugins = array_diff(scandir($pluginDir), ['.', '..']); |
57 | 61 | $pluginArray = []; |
@@ -59,7 +63,9 @@ discard block |
||
59 | 63 | foreach ($plugins as $pluginFolder) { |
60 | 64 | $path = $pluginDir . '/' . $pluginFolder; |
61 | 65 | |
62 | - if (!is_dir($path)) continue; |
|
66 | + if (!is_dir($path)) { |
|
67 | + continue; |
|
68 | + } |
|
63 | 69 | |
64 | 70 | $phpFiles = glob("$path/*.php"); |
65 | 71 | foreach ($phpFiles as $phpFile) { |
@@ -91,7 +97,9 @@ discard block |
||
91 | 97 | ]; |
92 | 98 | |
93 | 99 | $fp = fopen($file, 'r'); |
94 | - if (!$fp) return []; |
|
100 | + if (!$fp) { |
|
101 | + return []; |
|
102 | + } |
|
95 | 103 | |
96 | 104 | $data = fread($fp, 8192); |
97 | 105 | fclose($fp); |
@@ -114,7 +122,9 @@ discard block |
||
114 | 122 | if (isset($urlParts['path'])) { |
115 | 123 | $segments = explode('/', trim($urlParts['path'], '/')); |
116 | 124 | $lastSegment = end($segments); |
117 | - if ($lastSegment) return $lastSegment; |
|
125 | + if ($lastSegment) { |
|
126 | + return $lastSegment; |
|
127 | + } |
|
118 | 128 | } |
119 | 129 | } |
120 | 130 | |
@@ -126,10 +136,14 @@ discard block |
||
126 | 136 | { |
127 | 137 | $url = "https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=" . urlencode($slug); |
128 | 138 | $response = @file_get_contents($url); |
129 | - if (!$response) return null; |
|
139 | + if (!$response) { |
|
140 | + return null; |
|
141 | + } |
|
130 | 142 | |
131 | 143 | $pluginData = json_decode($response, true); |
132 | - if (!isset($pluginData['version'])) return null; |
|
144 | + if (!isset($pluginData['version'])) { |
|
145 | + return null; |
|
146 | + } |
|
133 | 147 | |
134 | 148 | $latestVersion = $pluginData['version']; |
135 | 149 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | { |
11 | 11 | if (!array_key_exists(ApacheServerNameCollector::COLLECTION_IDENTIFIER, $inventory) |
12 | 12 | || !is_array($inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]) |
13 | - ) return []; |
|
13 | + ) { |
|
14 | + return []; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | $configs = $inventory[ApacheServerNameCollector::COLLECTION_IDENTIFIER]; |
16 | 18 |
@@ -36,7 +36,9 @@ |
||
36 | 36 | foreach ($domains as $domain) { |
37 | 37 | try { |
38 | 38 | $url = $domain; |
39 | - if (!str_starts_with($url, 'http')) $url = 'https://' . $url; |
|
39 | + if (!str_starts_with($url, 'http')) { |
|
40 | + $url = 'https://' . $url; |
|
41 | + } |
|
40 | 42 | $response = $this->client->get($url); |
41 | 43 | } catch (ClientException $e) { |
42 | 44 | $response = $e->getResponse(); |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $runner = Runner::getInstance(); |
56 | 56 | |
57 | - if (!$runner->commandExists('apt')) return false; |
|
57 | + if (!$runner->commandExists('apt')) { |
|
58 | + return false; |
|
59 | + } |
|
58 | 60 | |
59 | 61 | return !empty($runner->run('apt-cache show unattended-upgrades 2>/dev/null')->getOutput()); |
60 | 62 | } |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | |
85 | 87 | foreach ($lines as $line) { |
86 | 88 | $line = trim(preg_replace('/#.*/', '', $line)); // Kommentare entfernen |
87 | - if ($line === '') continue; |
|
89 | + if ($line === '') { |
|
90 | + continue; |
|
91 | + } |
|
88 | 92 | |
89 | 93 | if (preg_match('/^\s*(\w+)\s+(yes|no)\s*$/i', $line, $matches)) { |
90 | 94 | $key = strtolower($matches[1]); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | private function parseListeningPorts(): array |
52 | 52 | { |
53 | - if(!Runner::getInstance()->commandExists("ss")) return []; |
|
53 | + if (!Runner::getInstance()->commandExists("ss")) return []; |
|
54 | 54 | |
55 | 55 | $output = Runner::outputToArray(Runner::getInstance()->run("ss -tuln")->getOutput()); |
56 | 56 |
@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | private function parseListeningPorts(): array |
52 | 52 | { |
53 | - if(!Runner::getInstance()->commandExists("ss")) return []; |
|
53 | + if(!Runner::getInstance()->commandExists("ss")) { |
|
54 | + return []; |
|
55 | + } |
|
54 | 56 | |
55 | 57 | $output = Runner::outputToArray(Runner::getInstance()->run("ss -tuln")->getOutput()); |
56 | 58 |
@@ -47,12 +47,16 @@ |
||
47 | 47 | |
48 | 48 | public function getNumberOfGreaterThan(string $key, int $threshold): int |
49 | 49 | { |
50 | - if (!array_key_exists($key, $this->data)) return 0; |
|
50 | + if (!array_key_exists($key, $this->data)) { |
|
51 | + return 0; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | $count = 0; |
53 | 55 | |
54 | 56 | foreach ($this->data[$key] as $value) { |
55 | - if ($value >= $threshold) $count++; |
|
57 | + if ($value >= $threshold) { |
|
58 | + $count++; |
|
59 | + } |
|
56 | 60 | } |
57 | 61 | |
58 | 62 | return $count; |