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.

JsonDriver::getLastVersion()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.1406

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
ccs 6
cts 8
cp 0.75
rs 9.4285
cc 3
eloc 6
nc 3
nop 0
crap 3.1406
1
<?php
2
3
namespace ChangelogParser\Driver;
4
5
class JsonDriver extends Driver {
6 5
    public function __construct() {
7 5
        parent::__construct();
8 5
        $this->storagePath = __DIR__ . '/../../data/changelog.json';
9 5
    }
10
    
11
    /**
12
     * {@inheritdoc}
13
     */
14 3
    public final function formatData($data) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, final should precede the visibility keyword.
Loading history...
15 3
        return json_encode($data);
16
    }
17
    
18
    /**
19
     * {@inheritdoc}
20
     */
21 2
    public final function getLastVersion() {
0 ignored issues
show
Coding Style introduced by
As per PSR2, final should precede the visibility keyword.
Loading history...
22 2
        $data = json_decode($this->getAllVersions(), true);
23
        
24 2
        foreach($data as $version => $changelog) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
25 2
            if($version === 'unreleased') {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
26 2
                continue;
27
            }
28 2
            return json_encode([$version => $changelog]);
29
        }
30
    }
31
    
32
    /**
33
     * {@inheritdoc}
34
     */
35 4
    public final function getAllVersions() {
0 ignored issues
show
Coding Style introduced by
As per PSR2, final should precede the visibility keyword.
Loading history...
36 4
        return file_get_contents($this->storagePath);
37
    }
38
}