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.

VersionUpdate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 20
c 2
b 0
f 0
dl 0
loc 50
ccs 0
cts 15
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 8 1
A toArray() 0 9 1
1
<?php
2
3
namespace NStack\Models;
4
5
/**
6
 * Class VersionUpdate
7
 *
8
 * @package NStack\Models
9
 * @author  Tiago Araujo <[email protected]>
10
 */
11
class VersionUpdate extends Model
12
{
13
    /** @var int */
14
    protected $id;
15
16
    /** @var String */
17
    protected $version;
18
19
    /** @var String */
20
    protected $update;
21
22
    /** @var bool */
23
    protected $newInVersion;
24
25
    /** @var String */
26
    protected $changeLog;
27
28
    /** @var String */
29
    protected $fileUrl;
30
31
    /**
32
     * parse
33
     *
34
     * @param array $data
35
     */
36
    public function parse(array $data)
37
    {
38
        $this->id = (String)$data['id'];
0 ignored issues
show
Documentation Bug introduced by
The property $id was declared of type integer, but (string)$data['id'] 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...
39
        $this->version = (array)$data['version'];
0 ignored issues
show
Documentation Bug introduced by
It seems like (array)$data['version'] of type array is incompatible with the declared type string of property $version.

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...
40
        $this->update = (string)$data['update'];
41
        $this->newInVersion = (array)$data['new_in_version'];
0 ignored issues
show
Documentation Bug introduced by
It seems like (array)$data['new_in_version'] of type array is incompatible with the declared type boolean of property $newInVersion.

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...
42
        $this->changeLog = (array)$data['change_log'];
0 ignored issues
show
Documentation Bug introduced by
It seems like (array)$data['change_log'] of type array is incompatible with the declared type string of property $changeLog.

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...
43
        $this->fileUrl = (array)$data['file_url'];
0 ignored issues
show
Documentation Bug introduced by
It seems like (array)$data['file_url'] of type array is incompatible with the declared type string of property $fileUrl.

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...
44
    }
45
46
    /**
47
     * toArray
48
     *
49
     * @return array
50
     * @author Casper Rasmussen <[email protected]>
51
     */
52
    public function toArray(): array
53
    {
54
        return [
55
            'id'             => $this->id,
56
            'version'        => $this->version,
57
            'update'         => $this->update,
58
            'new_in_version' => $this->newInVersion,
59
            'change_log'     => $this->changeLog,
60
            'file_url'       => $this->fileUrl,
61
        ];
62
    }
63
}