Failed Conditions
Pull Request — experimental/3.1 (#2356)
by Kentaro
70:45
created

CalculateStrategyCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setApplication() 0 3 1
A setOrder() 0 7 2
A add() 0 6 1
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