Completed
Pull Request — experimental/3.1 (#2154)
by Kentaro
448:33 queued 441:10
created

TaxStrategy::setApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

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 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace Eccube\Service\Calculator\Strategy;
4
5
use Eccube\Application;
6
use Eccube\Entity\Order;
7
use Eccube\Entity\OrderDetail;
8
use Eccube\Service\Calculator\OrderDetailCollection;
9
10
class TaxStrategy implements CalculateStrategyInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
11
{
12
    protected $app;
13
    protected $Order;
14
15 12
    public function __construct(Application $app = null)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
16
    {
17 12
        $this->app = $app;
18
    }
19
20 12
    public function execute(OrderDetailCollection $OrderDetails)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
21
    {
22
        // map でやりたい
23 12 View Code Duplication
        foreach ($OrderDetails as $OrderDetail) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24 12
            $tax = $this->app['eccube.service.tax_rule']
25 12
                ->calcTax($OrderDetail->getPrice(), $OrderDetail->getTaxRate(), $OrderDetail->getTaxRule());
26 12
            $OrderDetail->setPriceIncTax($OrderDetail->getPrice() + $tax);
27
        }
28
    }
29
30 12
    public function setApplication(Application $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
31
    {
32 12
        $this->app = $app;
33 12
        return $this;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
34
    }
35
36 12
    public function setOrder(Order $Order)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
37
    {
38 12
        $this->Order = $Order;
39 12
        return $this;
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
40
    }
41
}
42