Config   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 6
c 3
b 0
f 1
lcom 0
cbo 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B get() 0 11 6
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: vikkio88
5
 * Date: 01/11/2015
6
 * Time: 21:22
7
 */
8
9
namespace App\Lib\Helpers;
10
11
12
/**
13
 * Class Config
14
 * @package App\Lib\Helpers
15
 */
16
class Config
17
{
18
    /**
19
     * @param $key
20
     * @param null $directory
21
     * @return null
22
     */
23
    public static function get($key, $directory = null)
24
    {
25
        $fileName = $directory . "config/";
26
        $exp = explode(".", $key);
27
        if (is_array($exp) && $exp[0] != null && $exp[1] != null && file_exists($fileName . $exp[0] . ".php")) {
28
            $conf = include($fileName . $exp[0] . ".php");
29
            $val = array_key_exists($exp[1], $conf) ? $conf[$exp[1]] : null;
30
            return $val;
31
        }
32
        return null;
33
    }
34
35
}