Completed
Push — master ( bb1352...b3a836 )
by Tim
01:54 queued 11s
created
src/Listeners/SortCategoryListener.php 1 patch
Spacing   +5 added lines, -9 removed lines patch added patch discarded remove patch
@@ -164,11 +164,9 @@  discard block
 block discarded – undo
164 164
 
165 165
             // sort the main rows by the path, store_view_code and position
166 166
             // ATTENTION: we use uasort, because we NEED to preserve the keys
167
-            uasort($this->mainRows, function ($a, $b) {
167
+            uasort($this->mainRows, function($a, $b) {
168 168
                 return
169
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
170
-                    strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
171
-                    strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
169
+                    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]);
172 170
             });
173 171
 
174 172
             // update the position of the categories and the categories on the same level
@@ -181,11 +179,9 @@  discard block
 block discarded – undo
181 179
             $this->artefacts = array_merge(array_values($this->artefacts), $this->storeViewRows);
182 180
 
183 181
             // sort the artefacts again, because we want to export them in the expected order
184
-            usort($this->artefacts, function ($a, $b) {
182
+            usort($this->artefacts, function($a, $b) {
185 183
                 return
186
-                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?:
187
-                    strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]) ?:
188
-                    strcmp($a[ColumnKeys::POSITION], $b[ColumnKeys::POSITION]);
184
+                    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]);
189 185
             });
190 186
 
191 187
             // replace the artefacts to be exported later
@@ -275,7 +271,7 @@  discard block
 block discarded – undo
275 271
         }
276 272
 
277 273
         // sor the categories by their position and KEEP the keys
278
-        uasort($categoriesOnSameLevel, function ($a, $b) {
274
+        uasort($categoriesOnSameLevel, function($a, $b) {
279 275
             // return 0 when the position is equal (should never happen)
280 276
             if ($a[MemberNames::POSITION] == $b[MemberNames::POSITION]) {
281 277
                 return 0;
Please login to merge, or discard this patch.