Completed
Push — master ( 05e5ca...89c229 )
by Chris
02:12
created

Config::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
    namespace rAPId\Config;
4
5
    use rAPId\Data\ArrayFileReader;
6
7
    class Config
8
    {
9
        protected static $config = [];
10
        public static    $err    = '';
11
12
        /**
13
         * @param string $filename
14
         */
15
        public static function load($filename) {
16
            $reader = new ArrayFileReader($filename);
17
            self::$config = merge(self::$config, $reader->loadArray());
18
        }
19
20
        /**
21
         * Get the value of a config var
22
         *
23
         * @param string $var_name
24
         *
25
         * @return mixed|null
26
         */
27
        public static function val($var_name) {
28
            return array_get(self::$config, strtolower($var_name));
29
        }
30
    }