Passed
Push — master ( 799108...4106af )
by Rougin
01:34
created

FrameworkProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 35
ccs 4
cts 8
cp 0.5
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 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 Royce 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
            $providers = $config->get($this->providers);
42
43
            $provider = new $this->provider($providers);
44
45
            $container = $provider->register($container);
46
        }
47
48 9
        return $container;
49
    }
50
}
51