Completed
Push — master ( c628d7...8aa25c )
by Miloš
01:17
created

ContainerBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Laganica\Di;
4
5
use Laganica\Di\Resolver\ResolverFactory;
6
use Psr\Container\ContainerInterface;
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
    public function setAutowire(bool $autowire): void
24
    {
25
        $this->autowire = $autowire;
26
    }
27
28 6
    public function isAutowire(): bool
29
    {
30 6
        return $this->autowire;
31
    }
32
33
    /**
34
     * @return ContainerInterface
35
     */
36 6
    public function build(): ContainerInterface
37
    {
38 6
        $container = new Container(new ResolverFactory());
39 6
        $container->setAutowire($this->isAutowire());
40
41 6
        return $container;
42
    }
43
}
44