Failed Conditions
Push — experimental/3.1 ( da3a61...38e13d )
by chihiro
26s
created

CalculateStrategyCollection::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace Eccube\Service\Calculator;
4
5
use Eccube\Application;
6
use Eccube\Entity\Order;
7
use Eccube\Service\Calculator\CalculateStrategyInterface;
8
class CalculateStrategyCollection extends \Doctrine\Common\Collections\ArrayCollection
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
9
{
10
    protected $app;
11
    protected $Order;
12
13
    public function setApplication(Application $app) {
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
14
        $this->app = $app;
15
    }
16
17
    public function setOrder(Order $Order) {
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
18
        $this->Order = $Order;
19
        // TODO DI の定義で宣言的にセットしたい
20
        foreach ($this as $Strategy) {
21
            $Strategy->setOrder($this->Order);
22
        }
23
    }
24
25
    public function add($Strategy)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
26
    {
27
        // TODO 本当は取り出すときにインスタンス化したい
28
        $Strategy->setApplication($this->app);
29
        return parent::add($Strategy);
0 ignored issues
show
introduced by
Missing blank line before return statement
Loading history...
30
    }
31
}
32