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.

JsonParser::parse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Glenn\Config\Parser;
4
5
use Glenn\Config\Contracts\ParserContract;
6
7
/**
8
 * Parses a JSON string in to a format readable by the Config Manager.
9
 *
10
 * @author Glenn McEwan <[email protected]>
11
 */
12
class JsonParser implements ParserContract
13
{
14
    /**
15
     * {@inheritdoc}
16
     *
17
     * @param string $data JSON as a string
18
     *
19
     * @return array Array of data
20
     *
21
     * @author Glenn McEwan <[email protected]>
22
     */
23 6
    public function parse($data)
24
    {
25 6
        $array = json_decode($data, true);
26
27 6
        if ($array === null) {
28 4
            throw new ParseException('Unable to parse JSON.');
29
        }
30
31 2
        return $array;
32
    }
33
}
34