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.

Loader   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerParser() 0 8 2
A getParser() 0 8 2
1
<?php
2
3
namespace Glenn\Config;
4
5
use Glenn\Config\Contracts\ManagerContract;
6
use Glenn\Config\Contracts\LoaderContract;
7
use Glenn\Config\Contracts\ParserContract;
8
9
class Loader implements LoaderContract
10
{
11
    /**
12
     * The Config Manager.
13
     *
14
     * @var ManagerContract
15
     */
16
    protected $config;
17
18
    /**
19
     * The available config parsers.
20
     *
21
     * @var ParserContract[]
22
     */
23
    protected $parsers;
24
25
    /**
26
     * Construct a new Config Loader with the Config to load in to
27
     * being passed as a constructor dependency.
28
     *
29
     * @param Manager $config
30
     *
31
     * @author Glenn McEwan <[email protected]>
32
     */
33 2
    public function __construct(ManagerContract $config)
34
    {
35 2
        $this->config = $config;
36 2
    }
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @param ParserContract $parser
42
     * @param string         $key
43
     *
44
     * @return ParserContract
45
     *
46
     * @author Glenn McEwan <[email protected]>
47
     */
48 2
    public function registerParser(ParserContract $parser, $key = null)
49
    {
50 2
        if ($key === null) {
51 1
            $key = get_class($parser);
52 1
        }
53
54 2
        $this->parsers[$key] = $parser;
55 2
    }
56
57
    /**
58
     * {@inheritdoc}
59
     *
60
     * @param string $key Parser Key
61
     *
62
     * @return ParserContract
63
     *
64
     * @author Glenn McEwan <[email protected]>
65
     */
66 2
    public function getParser($key)
67
    {
68 2
        if (!array_key_exists($key, $this->parsers)) {
69 1
            return null;
70
        }
71
72 2
        return $this->parsers[$key];
73
    }
74
}
75