Config   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 34
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A get() 0 8 2
1
<?php namespace PascalKleindienst\FormListGenerator\Support;
2
3
/**
4
 * Simple Config class
5
 * @package \PascalKleindienst\FormListGenerator\Support
6
 */
7
class Config
8
{
9
    /**
10
     * @var array
11
     */
12
    protected static $items = [];
13
14
    /**
15
     * Set config items
16
     *
17
     * @param array $items
18
     * @return void
19
     */
20 54
    public static function set(array $items = [])
21
    {
22 54
        self::$items = array_merge(self::$items, $items);
23 54
    }
24
25
    /**
26
     * Get a config item if it exists or a default value if not
27
     *
28
     * @param string $key
29
     * @param mixed $default
30
     * @return mixed
31
     */
32 96
    public static function get($key, $default = null)
33
    {
34 96
        if (array_key_exists($key, self::$items)) {
35 63
            return self::$items[$key];
36
        }
37
38 42
        return $default;
39
    }
40
}
41