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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
c 3
b 2
f 0
dl 0
loc 41
wmc 3
lcom 1
cbo 0
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPath() 0 9 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