Completed
Push — master ( 6b6a31...ea3b57 )
by
unknown
16s
created
src/Listeners/SortCategoryListener.php 1 patch
Spacing   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -173,13 +173,11 @@  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
                 $a[ColumnKeys::STORE_VIEW_CODE] = $a[ColumnKeys::STORE_VIEW_CODE] ?: '';
178 178
                 $b[ColumnKeys::STORE_VIEW_CODE] = $b[ColumnKeys::STORE_VIEW_CODE] ?: '';
179 179
                 return
180
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
181
-                        strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
182
-                            strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
180
+                    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]);
183 181
             });
184 182
 
185 183
             // update the position of the categories and the categories on the same level
@@ -192,13 +190,11 @@  discard block
 block discarded – undo
192 190
             $this->artefacts = array_merge(array_values($this->artefacts), $this->storeViewRows);
193 191
 
194 192
             // sort the artefacts again, because we want to export them in the expected order
195
-            usort($this->artefacts, function ($a, $b) {
193
+            usort($this->artefacts, function($a, $b) {
196 194
                 $a[ColumnKeys::STORE_VIEW_CODE] = $a[ColumnKeys::STORE_VIEW_CODE] ?: '';
197 195
                 $b[ColumnKeys::STORE_VIEW_CODE] = $b[ColumnKeys::STORE_VIEW_CODE] ?: '';
198 196
                 return
199
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
200
-                    strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
201
-                    strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
197
+                    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]);
202 198
             });
203 199
 
204 200
             // replace the artefacts to be exported later
@@ -298,7 +294,7 @@  discard block
 block discarded – undo
298 294
         }
299 295
 
300 296
         // sor the categories by their position and KEEP the keys
301
-        uasort($categoriesOnSameLevel, function ($a, $b) {
297
+        uasort($categoriesOnSameLevel, function($a, $b) {
302 298
             // return 0 when the position is equal (should never happen)
303 299
             if ($a[MemberNames::POSITION] == $b[MemberNames::POSITION]) {
304 300
                 return 0;
@@ -446,7 +442,7 @@  discard block
 block discarded – undo
446 442
         // iterate over the IDs
447 443
         foreach ($ids as $id) {
448 444
             // load the category with the actual ID
449
-            $existingCategories = array_filter($this->existingCategories, function ($existingCategory) use ($id) {
445
+            $existingCategories = array_filter($this->existingCategories, function($existingCategory) use ($id) {
450 446
                 return (int) $existingCategory[MemberNames::ENTITY_ID] === (int) $id;
451 447
             });
452 448
 
Please login to merge, or discard this patch.