Completed
Pull Request — experimental/3.1 (#2361)
by chihiro
48:19
created

StrategyServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 17 1
1
<?php
2
3
namespace Plugin\Strategy\ServiceProvider;
4
5
use Eccube\Service\Calculator\CalculateStrategyCollection;
6
use Pimple\Container;
7
use Pimple\ServiceProviderInterface;
8
use Plugin\Strategy\Strategy\EmptyStrategy;
9
10
class StrategyServiceProvider implements ServiceProviderInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
11
{
12
    public function register(Container $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
13
    {
14
        // サンプルの空Strategyをコンテナに登録
15
        $app['eccube.calculate.strategy.empty'] = function () {
16
            return new EmptyStrategy();
17
        };
18
19
        // 空Strategyを追加.
20
        $app->extend(
21
            'eccube.calculate.strategies',
22
            function (CalculateStrategyCollection $Collection, Container $app) {
23
                $Collection->add($app['eccube.calculate.strategy.empty']);
24
25
                return $Collection;
26
            }
27
        );
28
    }
29
}
30