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::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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