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.

File::decodedContent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 2
nc 2
nop 0
crap 6
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\Resource\Contents;
4
5
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
6
use ApiClients\Foundation\Hydrator\Annotation\Nested;
7
use ApiClients\Foundation\Resource\AbstractResource;
8
use RuntimeException;
9
10
/**
11
 * @Nested(
12
 *     _links="Contents\Links"
13
 * )
14
 * @EmptyResource("Contents\EmptyFile")
15
 */
16
abstract class File extends AbstractResource implements FileInterface
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $type;
22
23
    /**
24
     * @var string
25
     */
26
    protected $encoding;
27
28
    /**
29
     * @var int
30
     */
31
    protected $size;
32
33
    /**
34
     * @var string
35
     */
36
    protected $name;
37
38
    /**
39
     * @var string
40
     */
41
    protected $path;
42
43
    /**
44
     * @var string
45
     */
46
    protected $content;
47
48
    /**
49
     * @var string
50
     */
51
    protected $sha;
52
53
    /**
54
     * @var string
55
     */
56
    protected $url;
57
58
    /**
59
     * @var string
60
     */
61
    protected $git_url;
62
63
    /**
64
     * @var string
65
     */
66
    protected $html_url;
67
68
    /**
69
     * @var string
70
     */
71
    protected $download_url;
72
73
    /**
74
     * @var string
75
     */
76
    protected $repository_fullname;
77
78
    /**
79
     * @var Links
80
     */
81
    // @codingStandardsIgnoreStart
82
    protected $_links;
83
    // @codingStandardsIgnoreEnd
84
85
    /**
86
     * @return string
87
     */
88 4
    public function type(): string
89
    {
90 4
        return $this->type;
91
    }
92
93
    /**
94
     * @return string
95
     */
96 4
    public function encoding(): string
97
    {
98 4
        return $this->encoding;
99
    }
100
101
    /**
102
     * @return int
103
     */
104 4
    public function size(): int
105
    {
106 4
        return $this->size;
107
    }
108
109
    /**
110
     * @return string
111
     */
112 4
    public function name(): string
113
    {
114 4
        return $this->name;
115
    }
116
117
    /**
118
     * @return string
119
     */
120 4
    public function path(): string
121
    {
122 4
        return $this->path;
123
    }
124
125
    /**
126
     * @return string
127
     */
128 4
    public function content(): string
129
    {
130 4
        return $this->content;
131
    }
132
133
    /**
134
     * @throws RuntimeException
135
     * @return string
136
     */
137
    public function decodedContent(): string
138
    {
139
        if ($this->encoding === 'base64') {
140
            return \base64_decode($this->content, true);
141
        }
142
143
        throw new RuntimeException('Unknown encoding: ' . $this->encoding);
144
    }
145
146
    /**
147
     * @return string
148
     */
149 4
    public function sha(): string
150
    {
151 4
        return $this->sha;
152
    }
153
154
    /**
155
     * @return string
156
     */
157 4
    public function url(): string
158
    {
159 4
        return $this->url;
160
    }
161
162
    /**
163
     * @return string
164
     */
165 4
    public function gitUrl(): string
166
    {
167 4
        return $this->git_url;
168
    }
169
170
    /**
171
     * @return string
172
     */
173 4
    public function htmlUrl(): string
174
    {
175 4
        return $this->html_url;
176
    }
177
178
    /**
179
     * @return string
180
     */
181 4
    public function downloadUrl(): string
182
    {
183 4
        return $this->download_url;
184
    }
185
186
    /**
187
     * @return string
188
     */
189 4
    public function repositoryFullname(): string
190
    {
191 4
        return $this->repository_fullname;
192
    }
193
194
    /**
195
     * @return Links
196
     */
197
    public function links(): Links
198
    {
199
        return $this->_links;
200
    }
201
}
202