Completed
Push — master ( c114be...0fe429 )
by
unknown
36s
created
src/Listeners/SortCategoryListener.php 1 patch
Spacing   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -173,11 +173,9 @@  discard block
 block discarded – undo
173 173
 
174 174
             // sort the main rows by the path, store_view_code and position
175 175
             // ATTENTION: we use uasort, because we NEED to preserve the keys
176
-            uasort($this->mainRows, function ($a, $b) {
176
+            uasort($this->mainRows, function($a, $b) {
177 177
                 return
178
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
179
-                    strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
180
-                    strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
178
+                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?: strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?: strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
181 179
             });
182 180
 
183 181
             // update the position of the categories and the categories on the same level
@@ -190,11 +188,9 @@  discard block
 block discarded – undo
190 188
             $this->artefacts = array_merge(array_values($this->artefacts), $this->storeViewRows);
191 189
 
192 190
             // sort the artefacts again, because we want to export them in the expected order
193
-            usort($this->artefacts, function ($a, $b) {
191
+            usort($this->artefacts, function($a, $b) {
194 192
                 return
195
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
196
-                    strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
197
-                    strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
193
+                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?: strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?: strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
198 194
             });
199 195
 
200 196
             // replace the artefacts to be exported later
@@ -294,7 +290,7 @@  discard block
 block discarded – undo
294 290
         }
295 291
 
296 292
         // sor the categories by their position and KEEP the keys
297
-        uasort($categoriesOnSameLevel, function ($a, $b) {
293
+        uasort($categoriesOnSameLevel, function($a, $b) {
298 294
             // return 0 when the position is equal (should never happen)
299 295
             if ($a[MemberNames::POSITION] == $b[MemberNames::POSITION]) {
300 296
                 return 0;
@@ -442,7 +438,7 @@  discard block
 block discarded – undo
442 438
         // iterate over the IDs
443 439
         foreach ($ids as $id) {
444 440
             // load the category with the actual ID
445
-            $existingCategories = array_filter($this->existingCategories, function ($existingCategory) use ($id) {
441
+            $existingCategories = array_filter($this->existingCategories, function($existingCategory) use ($id) {
446 442
                 return (int) $existingCategory[MemberNames::ENTITY_ID] === (int) $id;
447 443
             });
448 444
 
Please login to merge, or discard this patch.