Failed Conditions
Pull Request — experimental/3.1 (#2449)
by Kiyotaka
52:40
created

TaxStrategy::setApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
namespace Eccube\Service\Calculator\Strategy;
4
5
use Eccube\Application;
6
use Eccube\Entity\Order;
7
use Eccube\Entity\PurchaseInterface;
8
use Eccube\Entity\ShipmentItem;
9
use Eccube\Service\Calculator\ShipmentItemCollection;
10
11
class TaxStrategy implements CalculateStrategyInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
12
{
13
    protected $app;
14
    protected $Order;
15
16
    public function __construct(Application $app = null)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
17
    {
18
        $this->app = $app;
19
    }
20
21
    public function execute(ShipmentItemCollection $ShipmentItems)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
22
    {
23
        // map でやりたい
24
        /* @var ShipmentItem $ShipmentItem */
25 View Code Duplication
        foreach ($ShipmentItems as $ShipmentItem) {
26
            $tax = $this->app['eccube.service.tax_rule']
27
                ->calcTax($ShipmentItem->getPrice(), $ShipmentItem->getTaxRate(), $ShipmentItem->getTaxRule());
28
            $ShipmentItem->setPriceIncTax($ShipmentItem->getPrice() + $tax);
29
        }
30
    }
31
32
    public function setApplication(Application $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
33
    {
34
        $this->app = $app;
35
        return $this;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
36
    }
37
38
    public function setOrder(PurchaseInterface $Order)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
39
    {
40
        $this->Order = $Order;
41
        return $this;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
42
    }
43
44
    public function getTargetTypes()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
45
    {
46
        return [Order::class];
47
    }
48
}
49