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.

Driver::convert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 4
cts 4
cp 1
rs 10
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ChangelogParser\Driver;
4
5
use ChangelogParser\Parser\Parser;
6
7
abstract class Driver {
8
    /** @var ChangelogParser\Parser\Parser **/
9
    protected $parser;
10
    /** @var string **/
11
    protected $storagePath;
12
    
13 5
    public function __construct() {
14 5
        $this->parser = new Parser();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \ChangelogParser\Parser\Parser() of type object<ChangelogParser\Parser\Parser> is incompatible with the declared type object<ChangelogParser\D...ogParser\Parser\Parser> of property $parser.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
15 5
    }
16
    
17
    /**
18
     * @param string $storagePath
19
     * @return \ChangelogParser\Driver\Driver
20
     */
21 5
    public function setStoragePath($storagePath) {
22 5
        $this->storagePath = $storagePath;
23
        
24 5
        return $this;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getStoragePath() {
31
        return $this->storagePath;
32
    }
33
    
34
    /**
35
     * @param array $data
36
     * @return string
37
     */
38
    abstract protected function formatData($data);
39
    
40
    /**
41
     * @return mixed
42
     */
43
    abstract protected function getLastVersion();
44
    
45
    /**
46
     * @return mixed
47
     */
48
    abstract protected function getAllVersions();
49
    
50
    /**
51
     * @param string $filepath
52
     */
53 3
    public function convert($filepath) {
54 3
        $formattedData = $this->formatData($this->parser->parse($filepath));
55 3
        $this->storeResults($formattedData);
56 3
    }
57
    
58
    /**
59
     * @param mixed $data
60
     */
61 3
    protected function storeResults($data) {
62 3
        if(is_file($this->storagePath)) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
63 2
            unlink($this->storagePath);
64 2
        }
65 3
        file_put_contents($this->storagePath, $data);
66
    }
67
}