BridgeProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 36
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A register() 0 11 1
1
<?php
2
3
namespace Zapheus\Bridge\Symfony;
4
5
use Zapheus\Container\WritableInterface;
6
use Zapheus\Provider\ProviderInterface;
7
8
/**
9
 * Bridge Provider
10
 *
11
 * @package Zapheus
12
 * @author  Rougin Gutib <[email protected]>
13
 */
14
class BridgeProvider implements ProviderInterface
15
{
16
    const CONTAINER = 'Symfony\Component\DependencyInjection\Container';
17
18
    /**
19
     * @var \Symfony\Component\HttpKernel\Bundle\BundleInterface[]
20
     */
21
    protected $bundles;
22
23
    /**
24
     * Initializes the provider instance.
25
     *
26
     * @param \Symfony\Component\HttpKernel\Bundle\BundleInterface[] $bundles
27
     */
28 3
    public function __construct(array $bundles)
29
    {
30 3
        $this->bundles = $bundles;
31 3
    }
32
33
    /**
34
     * Registers the bindings in the container.
35
     *
36
     * @param  \Zapheus\Container\WritableInterface $container
37
     * @return \Zapheus\Container\ContainerInterface
38
     */
39 3
    public function register(WritableInterface $container)
40
    {
41 3
        $configuration = $container->get(ProviderInterface::CONFIG);
42
43 3
        $kernel = new ZapheusKernel($this->bundles, $configuration);
44
45 3
        $kernel->boot();
46
47 3
        $result = $kernel->getContainer();
48
49 3
        return $container->set(self::CONTAINER, $result);
50
    }
51
}
52