Completed
Push — master ( 64f4aa...2c8981 )
by Kamil
23:00
created

AdjustmentsRemover   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 0
cbo 1
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A removeFrom() 0 12 2
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