Skip to content

Commit

Permalink
added refactor notices
Browse files Browse the repository at this point in the history
  • Loading branch information
FCStephanAltmann committed Oct 15, 2019
1 parent d8cd752 commit 4e27b94
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Services/ReadData/External/ReadProductsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get(array $filter)

/**
* transforms api input into ValueArticle (targetEntity)
*
* TODO: refactor
* @param array $products
*
* @return ValueArticle[]
Expand Down Expand Up @@ -55,6 +55,7 @@ public function transform(array $products)
$valueArticle->setExternalIdentifier($product['ProductID']);
$valueArticle->setAnr($product['Anr']);

/** TODO: move + refactor start */
switch ((int)$this->config['ordernumberMapping']) {
case 0:
$valueArticle->setOrdernunmber($valueArticle->getExternalIdentifier());
Expand All @@ -70,6 +71,7 @@ public function transform(array $products)
}
break;
}
/** TODO: move end */

$valueArticle->setEan($product['EAN']);
$valueArticle->setName($product['Name']);
Expand Down Expand Up @@ -100,6 +102,7 @@ public function transform(array $products)
$helper = $this->helper;
$helper->addProductPictures($product, $valueArticle);

/** TODO: move start */
// catalogs - categories
if (array_key_exists('Catalogs', $product) && array_key_exists('CatalogID', $product['Catalogs'])) {
$catalogIDs = $product['Catalogs']['CatalogID'];
Expand All @@ -109,11 +112,13 @@ public function transform(array $products)

$valueArticle->setExternalCategoryIds($catalogIDs);
}
/** TODO: move end */

if ((int)$product['Quantity'] > (int)$product['MinimumStock'] && Helper::convertDeString2Float($product['SellingPrice'] > 0)) {
$valueArticle->setActive(true);
}

/** TODO: move start */
$variants = [];

if (!array_key_exists('Attributes', $product) && array_key_exists('BaseProducts', $product) && $product['BaseProductFlag'] !== '1'
Expand Down Expand Up @@ -149,7 +154,9 @@ public function transform(array $products)
}
}
}
/** TODO: move end */

/** TODO: move start */
if (
key_exists('BaseProductFlag', $product) and $product['BaseProductFlag'] !== '1'
or !key_exists('BaseProductFlag', $product)
Expand All @@ -160,6 +167,7 @@ public function transform(array $products)
if ( ! empty($variants) && $product['BaseProductFlag'] !== '1') {
$valueArticle->setVariants($variants);
}
/** TODO: move end */

if(!$valueArticle->getMainArticleId()) {
$valueArticles[] = $valueArticle;
Expand Down

0 comments on commit 4e27b94

Please sign in to comment.