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.

JsonFileParser::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
/**
6
 * Loads up a given file from a path, and passes the data to the parent JsonParser,
7
 * which will read the contents as a JSON string.
8
 *
9
 * @author Glenn McEwan <[email protected]>
10
 */
11
class JsonFileParser extends JsonParser
12
{
13
    /**
14
     * Override the parent, because we can parse from a given file's path,
15
     * rather than the file's string contents.
16
     *
17
     * @param  string                               $data Path to the JSON file to parse
18
     * @throws Bob\Filesystem\FileNotFoundException
19
     * @return array                                Parent's return value
20
     * @author Glenn McEwan <[email protected]>
21
     */
22 4
    public function parse($data)
23
    {
24 4
        if (!is_file($data)) {
25 1
            throw new ParseException('Unable to load file.');
26
        }
27
28 3
        $data = file_get_contents($data);
29
30 3
        return parent::parse($data);
31
    }
32
}
33