From 4e27b94288ef1cf63a717a4a4fe5dae8d39d6777 Mon Sep 17 00:00:00 2001 From: Stephan Altmann Date: Tue, 15 Oct 2019 17:47:41 +0200 Subject: [PATCH] added refactor notices --- Services/ReadData/External/ReadProductsService.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Services/ReadData/External/ReadProductsService.php b/Services/ReadData/External/ReadProductsService.php index 94f9f74..d5d045a 100644 --- a/Services/ReadData/External/ReadProductsService.php +++ b/Services/ReadData/External/ReadProductsService.php @@ -27,7 +27,7 @@ public function get(array $filter) /** * transforms api input into ValueArticle (targetEntity) - * + * TODO: refactor * @param array $products * * @return ValueArticle[] @@ -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()); @@ -70,6 +71,7 @@ public function transform(array $products) } break; } + /** TODO: move end */ $valueArticle->setEan($product['EAN']); $valueArticle->setName($product['Name']); @@ -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']; @@ -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' @@ -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) @@ -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;