Passed
Push — master ( 2533b4...0fe5f5 )
by Nils
02:41
created
src/Collector/Website/WordPress/WordPressCollector.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.