Passed
Push — master ( d4d417...37f3ab )
by Mike
03:14
created

AbstractConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
4
namespace Xervice\Core\Config;
5
6
7
use Xervice\Config\Exception\ConfigNotFound;
8
use Xervice\Config\XerviceConfig;
9
use Xervice\Core\Locator\Locator;
10
11
abstract class AbstractConfig implements ConfigInterface
12
{
13
    /**
14
     * @var \Xervice\Config\Container\ConfigContainer
15
     */
16
    private $config;
17
18
    /**
19
     * AbstractConfig constructor.
20
     * @throws \Xervice\Config\Exception\FileNotFound
21
     */
22 7
    public function __construct()
23
    {
24 7
        $this->config = XerviceConfig::getInstance()->getConfig();
25 7
    }
26
27
    /**
28
     * @param string $name
29
     * @param mixed $default
30
     *
31
     * @return mixed
32
     */
33 1
    public function get(string $name, $default = null)
34
    {
35
        try {
36 1
            return $this->config->get($name, $default);
37
        } catch (ConfigNotFound $exception) {
38
            Locator::getInstance()->exceptionHandler()->facade()->handleException();
0 ignored issues
show
Bug introduced by
The method handleException() does not exist on Xervice\Core\Facade\FacadeInterface. It seems like you code against a sub-type of Xervice\Core\Facade\FacadeInterface such as Xervice\ExceptionHandler\ExceptionHandlerFacade. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
            Locator::getInstance()->exceptionHandler()->facade()->/** @scrutinizer ignore-call */ handleException();
Loading history...
Bug introduced by
The method exceptionHandler() does not exist on Xervice\Core\Locator\Locator. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
            Locator::getInstance()->/** @scrutinizer ignore-call */ exceptionHandler()->facade()->handleException();
Loading history...
Bug introduced by
The method handleException() does not exist on Xervice\Core\Facade\EmptyFacade. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
            Locator::getInstance()->exceptionHandler()->facade()->/** @scrutinizer ignore-call */ handleException();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
        }
40
    }
41
42
43
}