Completed
Push — master ( e0bc2b...e3741e )
by Mike
03:00
created
src/Element/Section/UpgradeChanges.php 2 patches
Doc Comments   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@  discard block
 block discarded – undo
64 64
         ]);
65 65
     }
66 66
 
67
+    /**
68
+     * @param string $buildPath
69
+     */
67 70
     private function getChangedFiles($buildPath, $packages)
68 71
     {
69 72
         $changedFiles = $deletedFiles = $packageZips = [];
@@ -164,8 +167,8 @@  discard block
 block discarded – undo
164 167
     /**
165 168
      * Gets flav specific packages
166 169
      *
167
-     * @param $flav
168
-     * @param $packagesPath
170
+     * @param string $flav
171
+     * @param string $packagesPath
169 172
      *
170 173
      * @return array
171 174
      */
@@ -197,8 +200,8 @@  discard block
 block discarded – undo
197 200
      * Calculates an array of possible upgrade chains
198 201
      *
199 202
      * @param $packages
200
-     * @param $buildVersion
201
-     * @param $upgradeTo
203
+     * @param string $buildVersion
204
+     * @param string $upgradeTo
202 205
      *
203 206
      * @return array
204 207
      */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $deletedFiles = array_diff(array_merge($deletedFiles, $packageDeletedFiles), $packageChangedFiles);
92 92
         }
93 93
 
94
-        $changedFiles = array_keys(array_filter($changedFiles, function ($package, $changedFile) use ($buildPath, $packageZips) {
94
+        $changedFiles = array_keys(array_filter($changedFiles, function($package, $changedFile) use ($buildPath, $packageZips) {
95 95
             if (($buildFile = @file_get_contents($buildPath . DS . $changedFile)) === false) {
96 96
                 return false;
97 97
             }
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
             $zip->close();
105 105
         }
106 106
 
107
-        $changedFiles = array_values(array_filter($changedFiles, function ($file) use ($buildPath) {
107
+        $changedFiles = array_values(array_filter($changedFiles, function($file) use ($buildPath) {
108 108
             return file_exists($buildPath . '/custom/' . $file);
109 109
         }));
110 110
 
111
-        $deletedFiles = array_values(array_filter($deletedFiles, function ($file) use ($buildPath) {
111
+        $deletedFiles = array_values(array_filter($deletedFiles, function($file) use ($buildPath) {
112 112
             return file_exists($buildPath . '/custom/' . $file);
113 113
         }));
114 114
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             return [];
155 155
         }
156 156
 
157
-        usort($chains, function ($a1, $a2) {
157
+        usort($chains, function($a1, $a2) {
158 158
             return count($a1) < count($a2) ? -1 : (count($a1) > count($a2) ? 1 : 0);
159 159
         });
160 160
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $versionMatrix = $this->getVersionMatrix($packages);
208 208
         $allVersions = array_keys($versionMatrix);
209 209
 
210
-        $getExistingSubversions = function ($version) use ($allVersions) {
210
+        $getExistingSubversions = function($version) use ($allVersions) {
211 211
             $existingVersions = [];
212 212
 
213 213
             $fromParts = explode('.', $version);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         };
223 223
 
224 224
         // init chains with starting versions
225
-        $chains = array_map(function ($version) use ($buildVersion) {
225
+        $chains = array_map(function($version) use ($buildVersion) {
226 226
             return [$version => $buildVersion];
227 227
         }, $getExistingSubversions($buildVersion));
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         }
233 233
 
234 234
         // gets last key of assoc array
235
-        $getLastKey = function ($array) {
235
+        $getLastKey = function($array) {
236 236
             end($array);
237 237
 
238 238
             return key($array);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             $chains = $fullChains;
282 282
         }
283 283
 
284
-        $chains = array_map(function ($chain) use ($versionMatrix) {
284
+        $chains = array_map(function($chain) use ($versionMatrix) {
285 285
             $keys = array_keys($chain);
286 286
             $values = array_values($chain);
287 287
 
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
      */
312 312
     private function getVersionMatrix($packages)
313 313
     {
314
-        $allVersions = array_unique(call_user_func_array('array_merge', array_map(function ($package) {
314
+        $allVersions = array_unique(call_user_func_array('array_merge', array_map(function($package) {
315 315
             return [$package['from'], $package['to']];
316 316
         }, $packages)));
317 317
 
318 318
         // sort versions (ASC)
319
-        usort($allVersions, function ($v1, $v2) {
319
+        usort($allVersions, function($v1, $v2) {
320 320
             return version_compare($v1, $v2, '<') ? -1 : (version_compare($v1, $v2, '>') ? 1 : 0);
321 321
         });
322 322
 
323 323
         // create matrix and fill it with zeros
324
-        $versionMatrix = call_user_func_array('array_merge',array_map(function ($version) use ($allVersions) {
324
+        $versionMatrix = call_user_func_array('array_merge', array_map(function($version) use ($allVersions) {
325 325
             return [$version => array_combine($allVersions, array_fill(0, count($allVersions), 0))];
326 326
         }, $allVersions));
327 327
 
Please login to merge, or discard this patch.