Passed
Push — master ( 797714...39cab3 )
by Rougin
03:07
created

BridgeProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 Royce 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