Completed
Push — master ( b10958...e23a0f )
by Paweł
49:47 queued 34:50
created

AdjustmentsRemover::removeFrom()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Core\Remover;
13
14
use Sylius\Component\Core\Model\AdjustmentInterface;
15
use Sylius\Component\Core\Model\OrderInterface;
16
use Sylius\Component\Core\Model\OrderItemUnitInterface;
17
18
/**
19
 * @author Mateusz Zalewski <[email protected]>
20
 */
21
class AdjustmentsRemover implements AdjustmentsRemoverInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function removeFrom(OrderInterface $order)
27
    {
28
        $adjustmentsToRemove = [
29
            AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT,
30
            AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT,
31
            AdjustmentInterface::TAX_ADJUSTMENT
32
        ];
33
34
        foreach ($adjustmentsToRemove as $type) {
35
            $order->removeAdjustmentsRecursively($type);
36
        }
37
    }
38
}
39