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.
Completed
Push — master ( c11e1b...0baec8 )
by Jonny
03:47
created

JsonParser::parse()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 7
nc 3
nop 1
crap 30
1
<?php
2
3
/*
4
 * This file is part of the php-phantomjs.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
namespace JonnyW\PhantomJs\Parser;
10
11
/**
12
 * PHP PhantomJs
13
 *
14
 * @author Jon Wenmoth <[email protected]>
15
 */
16
class JsonParser implements ParserInterface
17
{
18
    /**
19
     * Parse json string into array.
20
     *
21
     * @access public
22
     * @param  string    $data
23
     * @return \stdClass
24
     */
25
    public function parse($data)
26
    {
27
        if ($data === null || !is_string($data)) {
28
            return array();
29
        }
30
31
        if (substr($data, 0, 1) !== '{' &&
32
            substr($data, 0, 1) !== '[') {
33
            return array();
34
        }
35
36
        return (array) json_decode($data, true);
37
    }
38
}
39