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

Config   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 3 1
A val() 0 2 1
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
    }