Completed
Push — master ( d0020c...40116c )
by wen
05:19
created

Factory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A makeFromUri() 0 5 1
A make() 0 11 2
A getConfigOptions() 0 5 1
1
<?php
2
3
4
namespace Sco\Admin\Config;
5
6
7
class Factory
8
{
9
    protected $config = null;
10
11
    public function __construct()
12
    {
13
14
    }
15
16
    public function makeFromUri($uri)
17
    {
18
        $name = str_replace('/', '.', $uri);
19
        return $this->make($name);
20
    }
21
22
    public function make($name)
23
    {
24
        $config = null;
25
        $options = $this->getConfigOptions($name);
26
        if ($options) {
27
            $config = new Config($options);
28
        }
29
        $this->config = $config;
30
31
        return $config;
32
    }
33
34
    protected function getConfigOptions($name)
35
    {
36
        $name = config('admin.model_config_dir') . '.' . $name;
37
        return config($name);
38
    }
39
}