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 ( 0baec8...65564e )
by Jonny
04:04
created

JsonParser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B parse() 0 13 5
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 51
    public function parse($data)
26
    {
27 51
        if ($data === null || !is_string($data)) {
28 2
            return array();
29
        }
30
31 49
        if (substr($data, 0, 1) !== '{' &&
32 49
            substr($data, 0, 1) !== '[') {
33 1
            return array();
34
        }
35
36 48
        return (array) json_decode($data, true);
37
    }
38
}
39