NullConfig::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace SKien\Config;
5
6
/**
7
 * Class for empty config.
8
 *
9
 * This class can be used to implement the <b>Null object Design Pattern</b>
10
 * (https://designpatternsphp.readthedocs.io/en/latest/Behavioral/NullObject/README.html).
11
 *
12
 * All calls to getXXX() allways returns the passed default value.
13
 * This class can be used as default instance for any module that uses
14
 * an Configuration imlementing the ConfigInterface.
15
 *
16
 * @package Config
17
 * @author Stefanius <[email protected]>
18
 * @copyright MIT License - see the LICENSE file for details
19
 */
20
class NullConfig extends AbstractConfig
21
{
22
    /**
23
     * Allways return the specified default value.
24
     * @param string $strPath
25
     * @param mixed $default
26
     * @return mixed
27
     */
28
    public function getValue(string $strPath, $default = null)
29
    {
30
        return $default;
31
    }
32
}
33