Completed
Push — master ( 5d3ec8...3a9e4e )
by Miloš
01:13
created

ContainerBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setAutowire() 0 4 1
A isAutowire() 0 4 1
A build() 0 7 1
1
<?php
2
3
namespace Laganica\Di;
4
5
use Laganica\Di\Definition\DefinitionFactory;
6
use Laganica\Di\Resolver\ResolverFactory;
7
8
/**
9
 * Class ContainerBuilder
10
 *
11
 * @package Laganica\Di
12
 */
13
class ContainerBuilder
14
{
15
    /**
16
     * @var bool
17
     */
18
    private $autowire = true;
19
20
    /**
21
     * @param bool $autowire
22
     */
23 1
    public function setAutowire(bool $autowire): void
24
    {
25 1
        $this->autowire = $autowire;
26 1
    }
27
28
    /**
29
     * @return bool
30
     */
31 16
    private function isAutowire(): bool
32
    {
33 16
        return $this->autowire;
34
    }
35
36
    /**
37
     * @return Container
38
     */
39 16
    public function build(): Container
40
    {
41 16
        $container = new Container(new DefinitionFactory(), new ResolverFactory());
42 16
        $container->setAutowire($this->isAutowire());
43
44 16
        return $container;
45
    }
46
}
47