ConfigServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
ccs 11
cts 11
cp 1
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 2
1
<?php
2
/**
3
 * @author    jan huang <[email protected]>
4
 * @copyright 2016
5
 *
6
 * @see      https://www.github.com/janhuang
7
 * @see      https://fastdlabs.com
8
 */
9
10
namespace FastD\ServiceProvider;
11
12
use FastD\Container\Container;
13
use FastD\Container\ServiceProviderInterface;
14
15
/**
16
 * Class ConfigServiceProvider.
17
 */
18
class ConfigServiceProvider implements ServiceProviderInterface
19
{
20
    /**
21
     * @param Container $container
22
     *
23
     * @return mixed
24
     */
25 32
    public function register(Container $container)
26
    {
27 32
        $dir = app()->getPath().'/config';
28 32
        $container->get('config')->load($dir.'/config.php');
29 32
        $container->get('config')->merge([
30 32
            'database' => load($dir.'/database.php'),
31 32
            'cache' => load($dir.'/cache.php'),
32 32
        ]);
33 32
        if (file_exists(app()->getPath().'/.env.yml')) {
34 32
            config()->merge(load(app()->getPath().'/.env.yml'));
35 32
        }
36 32
    }
37
}
38