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.

JsonQueryFactory::createWith()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
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 9
ccs 5
cts 5
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the json-query-wrapper package.
5
 *
6
 * (c) Enrico Stahn <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace JsonQueryWrapper;
13
14
use JsonQueryWrapper\DataProvider\File;
15
use JsonQueryWrapper\DataProvider\Text;
16
use Symfony\Component\Process\ProcessBuilder;
17
18
class JsonQueryFactory
19
{
20
    /**
21
     * Creates a JsonQuery object without data provider.
22
     *
23
     * @return JsonQuery
24
     */
25 1
    public static function create()
26
    {
27 1
        return new JsonQuery(new ProcessBuilder(), new DataTypeMapper());
28
    }
29
30
    /**
31
     * Creates a JsonQuery object with data provider.
32
     *
33
     * @param string $filenameOrText A path to a json file or json text
34
     *
35
     * @return JsonQuery
36
     */
37 1
    public static function createWith($filenameOrText)
38
    {
39 1
        $provider = file_exists($filenameOrText) ? new File($filenameOrText) : new Text($filenameOrText);
40
41 1
        $jq = new JsonQuery(new ProcessBuilder(), new DataTypeMapper());
42 1
        $jq->setDataProvider($provider);
43
44 1
        return $jq;
45
    }
46
}
47