Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Self review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszpietrzak1994 committed Jun 12, 2018
1 parent 6dfdb0d commit 4c45e62
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/ReorderEligibility/ItemsOutOfStockEligibilityChecker.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

Expand All @@ -29,20 +21,18 @@ public function __construct(

public function check(OrderInterface $order, OrderInterface $reorder)
{
$isAnyItemOutOfStock = false;
$variantsOutOfStock = [];

/** @var OrderItemInterface $orderItem */
foreach ($order->getItems()->getValues() as $orderItem) {
/** @var ProductVariantInterface $productVariant */
$productVariant = $orderItem->getVariant();
if (!($productVariant->isTracked() && $productVariant->isInStock())) {
$isAnyItemOutOfStock = true;
array_push($variantsOutOfStock, $orderItem->getVariantName());
}
}

if (!$isAnyItemOutOfStock) {
if (empty($variantsOutOfStock)) {
return [];
}

Expand Down

0 comments on commit 4c45e62

Please sign in to comment.