FrameworkProvider::register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace App\Zapheus;
4
5
use Zapheus\Container\WritableInterface;
6
use Zapheus\Provider\ProviderInterface;
7
8
/**
9
 * Framework Provider
10
 *
11
 * @package App
12
 * @author  Rougin Gutib <[email protected]>
13
 */
14
class FrameworkProvider implements ProviderInterface
15
{
16
    /**
17
     * Class name of the bridge provider.
18
     *
19
     * @var string
20
     */
21
    protected $provider = '';
22
23
    /**
24
     * Configuration path for the providers.
25
     *
26
     * @var string
27
     */
28
    protected $providers = '';
29
30
    /**
31
     * Registers the bindings in the container.
32
     *
33
     * @param  \Zapheus\Container\WritableInterface $container
34
     * @return \Zapheus\Container\ContainerInterface
35
     */
36 9
    public function register(WritableInterface $container)
37
    {
38 9
        $config = $container->get(ProviderInterface::CONFIG);
39
40 9
        if (class_exists($this->provider) === true)
41 3
        {
42 9
            $providers = $config->get($this->providers);
43
44 9
            $provider = new $this->provider($providers);
45
46 9
            $container = $provider->register($container);
47 3
        }
48
49 9
        return $container;
50
    }
51
}
52