Skip to content

Commit c5f904e

Browse files
committed
Changes according to pull request reviews
1 parent 57fbe6a commit c5f904e

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

Model/Adapters/NestedArrayAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public function __construct(array $data, string $multipleValueSeparator = ', ')
2626
}
2727

2828
/**
29-
* Transform nested array to string
29+
* Transform nested array to flat array of strings
3030
*/
31-
private function convertToArray(array &$line)
31+
private function convertToArray(array &$line): void
3232
{
3333
$implodeStr = $this->multipleValueSeparator;
3434
$array = array_map(

Model/Config/Source/Behavior.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ class Behavior implements \Magento\Framework\Option\ArrayInterface
1414

1515
/**
1616
* Return available behaviors
17-
*
18-
* @return array
1917
*/
20-
public function toOptionArray()
18+
public function toOptionArray(): array
2119
{
2220
if ($this->options === null) {
2321
$this->options = [

Model/Config/Source/ValidationStrategy.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ class ValidationStrategy implements \Magento\Framework\Option\ArrayInterface
1414

1515
/**
1616
* Return available validation strategies
17-
*
18-
* @return array
1917
*/
20-
public function toOptionArray()
18+
public function toOptionArray(): array
2119
{
2220
if ($this->options === null) {
2321
$this->options = [

Model/Import/Category.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class Category extends \Magento\ImportExport\Model\Import\AbstractEntity
199199
private $symbolIgnoreFields = false;
200200

201201
private int $defaultAttributeSetId = 0;
202-
private CategoryImportVersion $categoryImportVersionFeature;
202+
private ?CategoryImportVersion $categoryImportVersionFeature;
203203
private ?Uploader $fileUploader = null;
204204
private DirectoryWriteInterface $mediaDirectory;
205205
private StoreManagerInterface $storeManager;
@@ -383,7 +383,7 @@ private function initCategories(): self
383383
}
384384

385385
$index = $this->implodeEscaped(
386-
$this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
386+
(string) $this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
387387
$path
388388
);
389389
$this->categoriesWithRoots[$rootCategoryName][$index] = [
@@ -861,13 +861,13 @@ private function getCategoryName(array $rowData): string
861861
}
862862

863863
$categoryParts = $this->explodeEscaped(
864-
$this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
864+
(string) $this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
865865
$rowData[self::COL_CATEGORY]
866866
);
867867
return end($categoryParts);
868868
}
869869

870-
private function explodeEscaped(string $delimiter = '/', string $string): array
870+
private function explodeEscaped(string $delimiter, string $string): array
871871
{
872872
$exploded = explode($delimiter, $string);
873873
$fixed = [];
@@ -911,12 +911,12 @@ protected function getParentCategory(array $rowData)
911911
$parent = $categoryParts[count($categoryParts) - 2];
912912
} else {
913913
$categoryParts = $this->explodeEscaped(
914-
$this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
914+
(string) $this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
915915
$rowData[self::COL_CATEGORY]
916916
);
917917
array_pop($categoryParts);
918918
$parent = $this->implodeEscaped(
919-
$this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
919+
(string) $this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR),
920920
$categoryParts
921921
);
922922
}
@@ -1170,7 +1170,9 @@ private function getUploader(): Uploader
11701170
private function saveCategoryEntity(array $entityRowsIn, array $entityRowsUp): self
11711171
{
11721172
if ($entityRowsIn) {
1173-
$entityRowsIn = $this->categoryImportVersionFeature->processCategory($entityRowsIn);
1173+
if ($this->categoryImportVersionFeature !== null) {
1174+
$entityRowsIn = $this->categoryImportVersionFeature->processCategory($entityRowsIn);
1175+
}
11741176

11751177
$this->_connection->insertMultiple($this->entityTable, $entityRowsIn);
11761178
}
@@ -1197,7 +1199,11 @@ private function saveCategoryEntity(array $entityRowsIn, array $entityRowsUp): s
11971199
*/
11981200
private function saveCategoryAttributes(array $attributesData): self
11991201
{
1200-
$entityFieldName = $this->categoryImportVersionFeature->getEntityFieldName();
1202+
if ($this->categoryImportVersionFeature !== null) {
1203+
$entityFieldName = $this->categoryImportVersionFeature->getEntityFieldName();
1204+
} else {
1205+
$entityFieldName = 'entity_id';
1206+
}
12011207

12021208
$entityIds = array();
12031209

0 commit comments

Comments
 (0)