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.
Failed Conditions
Push — master ( 550dab...bc8237 )
by Casper
03:45 queued 02:01
created

VersionControlUpdate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 31.58%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 73
ccs 6
cts 19
cp 0.3158
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getUpdate() 0 3 1
A toArray() 0 7 1
A isNewInVersion() 0 3 1
A parse() 0 6 1
A getNewInVersions() 0 3 1
A getUpdateVersions() 0 3 1
1
<?php
2
3
namespace NStack\Models;
4
5
/**
6
 * Class VersionControlUpdate
7
 *
8
 * @package NStack\Models
9
 * @author  Tiago Araujo <[email protected]>
10
 */
11
class VersionControlUpdate extends Model
12
{
13
    /** @var String */
14
    protected $update;
15
16
    /** @var array */
17
    protected $updateVersions;
18
19
    /** @var bool */
20
    protected $newInVersion;
21
22
    /** @var array */
23
    protected $newInVersions;
24
25
    /**
26
     * parse
27
     *
28
     * @param array $data
29
     */
30 1
    public function parse(array $data)
31
    {
32 1
        $this->update = (String)$data['update'];
33 1
        $this->updateVersions = (array)$data['update_versions'];
34 1
        $this->newInVersion = (string)$data['new_in_version'];
0 ignored issues
show
Documentation Bug introduced by
The property $newInVersion was declared of type boolean, but (string)$data['new_in_version'] is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
35 1
        $this->newInVersions = (array)$data['new_in_versions'];
36 1
    }
37
38
    /**
39
     * toArray
40
     *
41
     * @return array
42
     * @author Casper Rasmussen <[email protected]>
43
     */
44
    public function toArray(): array
45
    {
46
        return [
47
            'update' => $this->update,
48
            'update_versions' => $this->updateVersions,
49
            'new_in_version' => $this->newInVersion,
50
            'new_in_versions' => $this->newInVersions,
51
        ];
52
    }
53
54
    /**
55
     * @return String
56
     */
57
    public function getUpdate(): String
58
    {
59
        return $this->update;
60
    }
61
62
    /**
63
     * @return array
64
     */
65
    public function getUpdateVersions(): array
66
    {
67
        return $this->updateVersions;
68
    }
69
70
    /**
71
     * @return bool
72
     */
73
    public function isNewInVersion(): bool
74
    {
75
        return $this->newInVersion;
76
    }
77
78
    /**
79
     * @return array
80
     */
81
    public function getNewInVersions(): array
82
    {
83
        return $this->newInVersions;
84
    }
85
86
}