@@ -197,7 +197,7 @@ |
||
197 | 197 | { |
198 | 198 | |
199 | 199 | // explode the path of the root category |
200 | - list ($rootCategoryPath, ) = explode('/', $path); |
|
200 | + list ($rootCategoryPath,) = explode('/', $path); |
|
201 | 201 | |
202 | 202 | // query whether or not a root category with the given path exists |
203 | 203 | if ($rootCategory = $this->getCategoryByPath($rootCategoryPath)) { |
@@ -303,7 +303,7 @@ |
||
303 | 303 | |
304 | 304 | // load the global data we've prepared initially |
305 | 305 | $this->taxClasses = $status[RegistryKeys::GLOBAL_DATA][RegistryKeys::TAX_CLASSES]; |
306 | - $this->storeWebsites = $status[RegistryKeys::GLOBAL_DATA][RegistryKeys::STORE_WEBSITES]; |
|
306 | + $this->storeWebsites = $status[RegistryKeys::GLOBAL_DATA][RegistryKeys::STORE_WEBSITES]; |
|
307 | 307 | |
308 | 308 | // load the categories for the admin store view from the global data |
309 | 309 | $this->categories = $status[RegistryKeys::GLOBAL_DATA][RegistryKeys::CATEGORIES][StoreViewCodes::ADMIN]; |
@@ -86,8 +86,8 @@ |
||
86 | 86 | // load the columns from the metadata |
87 | 87 | $columns = array_filter( |
88 | 88 | $columnMetadataLoader->load($entityType), |
89 | - function ($value) { |
|
90 | - return $value['Key'] !== 'PRI' && $value['Null'] === 'NO' ; |
|
89 | + function($value) { |
|
90 | + return $value['Key'] !== 'PRI' && $value['Null'] === 'NO'; |
|
91 | 91 | } |
92 | 92 | ); |
93 | 93 | // initialize the raw entities and their default values, if available |
@@ -99,7 +99,7 @@ |
||
99 | 99 | |
100 | 100 | // skip update of URL rewrite, if nothing to change |
101 | 101 | if ($targetPath === $existingUrlRewrite[MemberNames::TARGET_PATH] && |
102 | - 301 === (int)$existingUrlRewrite[MemberNames::REDIRECT_TYPE]) { |
|
102 | + 301 === (int) $existingUrlRewrite[MemberNames::REDIRECT_TYPE]) { |
|
103 | 103 | // stop processing the URL rewrite |
104 | 104 | continue; |
105 | 105 | } |
@@ -123,7 +123,7 @@ |
||
123 | 123 | public function findAllByPath($path) |
124 | 124 | { |
125 | 125 | // load and return the categories with the passed path |
126 | - $this->categoryByPathChildrenStmt->execute(array(MemberNames::PATH => $path.'/%')); |
|
126 | + $this->categoryByPathChildrenStmt->execute(array(MemberNames::PATH => $path . '/%')); |
|
127 | 127 | $result = $this->categoryByPathChildrenStmt->fetchAll(\PDO::FETCH_ASSOC); |
128 | 128 | return $result ? $result : []; |
129 | 129 | } |
@@ -176,7 +176,7 @@ |
||
176 | 176 | $this->prepareStoreViewCode(); |
177 | 177 | |
178 | 178 | // explode the path into the category names |
179 | - if ($categories = $this->getValue(ColumnKeys::PATH, array(), function ($value) { |
|
179 | + if ($categories = $this->getValue(ColumnKeys::PATH, array(), function($value) { |
|
180 | 180 | return $this->serializer->explode($value); |
181 | 181 | })) { |
182 | 182 | // initialize the flag to query whether or not the category is a leaf |
@@ -94,7 +94,7 @@ |
||
94 | 94 | */ |
95 | 95 | protected function process() |
96 | 96 | { |
97 | - $this->setValue(ColumnKeys::PATH, $this->getValue(ColumnKeys::PATH, null, function ($value) { |
|
97 | + $this->setValue(ColumnKeys::PATH, $this->getValue(ColumnKeys::PATH, null, function($value) { |
|
98 | 98 | return $this->serializer->normalize($value); |
99 | 99 | })); |
100 | 100 | } |
@@ -143,7 +143,7 @@ |
||
143 | 143 | |
144 | 144 | $storeId = $this->getSubject()->getRowStoreId($storeViewCode); |
145 | 145 | $category = $this->getCategoryByPkAndStoreId($this->mapPath($path), $storeId); |
146 | - if ($storeViewCodeValue === StoreViewCodes::ADMIN && $category) { |
|
146 | + if ($storeViewCodeValue === StoreViewCodes::ADMIN && $category) { |
|
147 | 147 | // load the url_key attribute |
148 | 148 | $urlKey = $this->loadExistingUrlKey($category, $storeViewCode); |
149 | 149 | // if url_key attribute found and same store as searched |
@@ -173,13 +173,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |