Skip to content

Commit

Permalink
Fix phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
vpodorozh committed Sep 22, 2023
1 parent 3a2eb41 commit e5286b2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Service/GenerateFeedForStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Magento\Bundle\Model\Product\Type as BundleProduct;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Type\AbstractType;
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Framework\Exception\FileSystemException;
Expand Down Expand Up @@ -115,6 +116,8 @@ public function execute(StoreInterface $store): void
if ($typeInstance instanceof Configurable || $typeInstance instanceof Grouped) {
$confAndGroupedRows =
$this->getConfigurableAndGroupedRows($typeInstance, $product, $attributesConfigList);

// @phpcs:ignore
$rows = array_merge($rows, $confAndGroupedRows);

$currentPage++;
Expand All @@ -124,6 +127,7 @@ public function execute(StoreInterface $store): void
// BUNDLE PRODUCTS FLOW
if ($typeInstance instanceof BundleProduct) {
$bundleRows = $this->getBundleProductRows($typeInstance, $product, $attributesConfigList);
// @phpcs:ignore
$rows = array_merge($rows, $bundleRows);

$currentPage++;
Expand Down Expand Up @@ -161,12 +165,11 @@ private function canProceed(ProductCollection $productCollection, int $currentPa
* @throws GenerateFeedForStoreException
* @throws NoSuchEntityException
*/
public function getConfigurableAndGroupedRows(
Grouped|Configurable $typeInstance,
private function getConfigurableAndGroupedRows(
AbstractType $typeInstance,
Product $product,
AttributeConfigDataList $attributesConfigList
): array
{
): array {
$rows = [];

$childProducts = $typeInstance instanceof Grouped ?
Expand All @@ -182,7 +185,7 @@ public function getConfigurableAndGroupedRows(
->get($childProduct->getSku(), false, $childProduct->getStoreId());
$rows[$childProduct->getId()] = $this->productToRowMapper
->map($childProduct, $attributesConfigList);
} catch (HandlerIsNotSpecifiedException|WrongInstanceException $exception) {
} catch (HandlerIsNotSpecifiedException | WrongInstanceException $exception) {
throw new GenerateFeedForStoreException(
__(
'Product can not be mapped to feed row. Product ID: %1 . Error: %2',
Expand All @@ -201,12 +204,11 @@ public function getConfigurableAndGroupedRows(
* @throws GenerateFeedForStoreException
* @throws NoSuchEntityException
*/
public function getBundleProductRows(
private function getBundleProductRows(
BundleProduct $typeInstance,
Product $product,
AttributeConfigDataList $attributesConfigList
): array
{
): array {
$rows = [];
$childProductIds = $typeInstance->getChildrenIds($product->getId());

Expand All @@ -222,7 +224,7 @@ public function getBundleProductRows(

$rows[$childProduct->getId()] = $this->productToRowMapper
->map($childProduct, $attributesConfigList);
} catch (HandlerIsNotSpecifiedException|WrongInstanceException $exception) {
} catch (HandlerIsNotSpecifiedException | WrongInstanceException $exception) {
throw new GenerateFeedForStoreException(
__(
'Product can not be mapped to feed row. Product ID: %1 . Error: %2',
Expand Down

0 comments on commit e5286b2

Please sign in to comment.