Container::makeContainer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
4
namespace TKuni\PhpNormalizer;
5
6
use League\Container\Container as BaseContainer;
7
use TKuni\PhpNormalizer\Contracts\FilterProviderContract;
8
use TKuni\PhpNormalizer\Contracts\PipelineBuilderFactoryContract;
9
10
class Container
11
{
12
    /**
13
     * @var null|BaseContainer
14
     */
15
    private static $container = null;
16
17 8
    public static function container() : BaseContainer {
18 8
        if (self::$container === null) {
19 1
            self::$container = self::makeContainer();
20
        }
21
22 8
        return self::$container;
23
    }
24
25 1
    private static function makeContainer() {
26 1
        $c = new BaseContainer();
27
28 1
        $c->add(PipelineBuilderFactoryContract::class, PipelineBuilderFactory::class);
29 1
        $c->add(FilterProviderContract::class, DefaultFilterProvider::class, true);
30
31 1
        return $c;
32
    }
33
}