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.

Text::getPath()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
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\DataProvider;
13
14
/**
15
 * Converts text (string) to be consumed by jq.
16
 */
17
class Text implements DataProviderInterface
18
{
19
    /**
20
     * Text data to be converted.
21
     *
22
     * @var string
23
     */
24
    protected $data;
25
26
    /**
27
     * Path to the generated file.
28
     *
29
     * @var string
30
     */
31
    protected $path;
32
33
    /**
34
     * Text constructor.
35
     *
36
     * @param $data
37
     */
38 2
    public function __construct($data)
39
    {
40 2
        $this->data = $data;
41 2
    }
42
43
    /**
44
     * Returns the path to the generated file.
45
     *
46
     * @return string
47
     */
48 1
    public function getPath()
49
    {
50 1
        if (empty($this->path)) {
51 1
            $this->path = tempnam(sys_get_temp_dir(), 'jq');
52 1
            file_put_contents($this->path, $this->data);
53 1
        }
54
55 1
        return $this->path;
56
    }
57
}
58