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.
Passed
Push — master ( 556562...8743ff )
by Casper
07:04 queued 05:11
created

CollectionShow2   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 72
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getPrice() 0 3 1
A getDescription() 0 3 1
A toArray() 0 7 1
A parse() 0 6 1
A getTitle() 0 3 1
1
<?php
2
3
namespace NStack\Tests\objects;
4
5
use NStack\Models\Model;
6
7
/**
8
 * Class CollectionShow2
9
 *
10
 * @package NStack\Tests\objects
11
 * @author  Tiago Araujo <[email protected]>
12
 */
13
class CollectionShow2 extends Model
14
{
15
    /** @var int */
16
    protected $id;
17
18
    /** @var string */
19
    protected $title;
20
21
    /** @var string */
22
    protected $description;
23
24
    /** @var float */
25
    protected $price;
26
27
    /**
28
     * parse
29
     *
30
     * @param array $data
31
     */
32
    public function parse(array $data)
33
    {
34
        $this->id           = (int)$data['id'];
35
        $this->title        = (string)$data['Title'];
36
        $this->description  = (string)$data['Description'];
37
        $this->price        = (string)$data['Price'];
0 ignored issues
show
Documentation Bug introduced by
The property $price was declared of type double, but (string)$data['Price'] 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...
38
    }
39
40
    /**
41
     * toArray
42
     *
43
     * @return array
44
     */
45
    public function toArray(): array
46
    {
47
        return [
48
            'id'            => $this->id,
49
            'Title'         => $this->title,
50
            'Description'   => $this->description,
51
            'Price'         => $this->price,
52
        ];
53
    }
54
55
    /**
56
     * @return int
57
     */
58
    public function getId(): int
59
    {
60
        return $this->id;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getTitle(): string
67
    {
68
        return $this->title;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getDescription(): string
75
    {
76
        return $this->description;
77
    }
78
79
    /**
80
     * @return float
81
     */
82
    public function getPrice(): float
83
    {
84
        return $this->price;
85
    }
86
87
}