Completed
Push — master ( 975266...b367bc )
by Tim
01:37
created
src/Listeners/SortCategoryListener.php 1 patch
Spacing   +5 added lines, -8 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,10 +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]);
184
+                    strcmp($a[ColumnKeys::PATH], $b[ColumnKeys::PATH]) ?: strcmp($a[ColumnKeys::STORE_VIEW_CODE], $b[ColumnKeys::STORE_VIEW_CODE]);
188 185
             });
189 186
 
190 187
             // replace the artefacts to be exported later
@@ -279,7 +276,7 @@  discard block
 block discarded – undo
279 276
         }
280 277
 
281 278
         // sor the categories by their position and KEEP the keys
282
-        uasort($categoriesOnSameLevel, function ($a, $b) {
279
+        uasort($categoriesOnSameLevel, function($a, $b) {
283 280
             // return 0 when the position is equal (should never happen)
284 281
             if ($a[MemberNames::POSITION] == $b[MemberNames::POSITION]) {
285 282
                 return 0;
Please login to merge, or discard this patch.