GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractFacade   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 61
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 8 2
A isNested() 0 4 2
1
<?php
2
3
namespace Glenn\Config\Facade;
4
5
use Glenn\Config\Contracts\FacadeContract;
6
use Glenn\Config\Contracts\ManagerContract;
7
8
/**
9
 * Config Facade to help with retrieving data, from the config, which is pertintent to one specific section.
10
 *
11
 * This means we can have interfaced Config Managers to aid with ensuring that we don't rely
12
 * on the config key names, which will make the code more readable and testable.
13
 *
14
 * @author Glenn McEwan <[email protected]>
15
 */
16
abstract class AbstractFacade implements FacadeContract
17
{
18
    /**
19
     * Config manager.
20
     *
21
     * @var ManagerContract
22
     */
23
    protected $config;
24
25
    /**
26
     * The parent key of this Facade's config entries.
27
     *
28
     * @var string
29
     */
30
    protected $parentKey = null;
31
32
    /**
33
     * Construct a new Facade and pass in the config.
34
     *
35
     * @param ManagerContract $config
36
     *
37
     * @author Glenn McEwan <[email protected]>
38
     */
39 2
    public function __construct(ManagerContract $config)
40
    {
41 2
        $this->config = $config;
42 2
    }
43
44
    /**
45
     * Get a value from the config.
46
     * Decorated to pull from the parent if this Facade uses a parent key.
47
     *
48
     * @param string $key     The Config key to fetch the value for
49
     * @param mixed  $default the default, if the config key does not exist
50
     *
51
     * @return mixed the config value, could be a string, array, etc
52
     *
53
     * @author Glenn McEwan <[email protected]>
54
     */
55 2
    public function get($key, $default = null)
56
    {
57 2
        if ($this->isNested()) {
58 1
            $key = $this->parentKey . '.' . $key;
59 1
        }
60
61 2
        return $this->config->get($key, $default);
62
    }
63
64
    /**
65
     * When fetching config entries from this facade,
66
     * are they nested under one parent / head key?
67
     *
68
     * @return bool
69
     *
70
     * @author Glenn McEwan <[email protected]>
71
     */
72 2
    protected function isNested()
73
    {
74 2
        return $this->parentKey ? true : false;
75
    }
76
}
77