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

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

Changes 4
Bugs 0 Features 4
Metric Value
wmc 6
c 4
b 0
f 4
lcom 1
cbo 1
dl 0
loc 61
ccs 16
cts 18
cp 0.8889
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setStoragePath() 0 5 1
A getStoragePath() 0 3 1
formatData() 0 1 ?
getLastVersion() 0 1 ?
getAllVersions() 0 1 ?
A convert() 0 4 1
A storeResults() 0 6 2
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
}