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

AbstractConfig   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 28
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

2 Methods

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