Passed
Branch release/1.5.0 (d52397)
by vincent
02:35
created

Image::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 3
crap 1
1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5
use vfalies\tmdb\Abstracts\Results;
6
use vfalies\tmdb\Tmdb;
7
8
class Image extends Results
9
{
10
11
    protected $aspect_ratio;
12
    protected $file_path;
13
    protected $height;
14
    protected $iso_639_1;
15
    protected $vote_average;
16
    protected $vote_count;
17
    protected $width;
18
19 18
    public function __construct(Tmdb $tmdb, $id, \stdClass $result)
20
    {
21 18
        parent::__construct($tmdb, $result);
22
23 17
        $this->id           = (int) $id;
0 ignored issues
show
Bug introduced by
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24 17
        $this->aspect_ratio = $result->aspect_ratio;
25 17
        $this->file_path    = $result->file_path;
26 17
        $this->height       = $result->height;
27 17
        $this->iso_639_1    = $result->iso_639_1;
28 17
        $this->vote_average = $result->vote_average;
29 17
        $this->vote_count   = $result->vote_count;
30 17
        $this->width        = $result->width;
31 17
    }
32
33 1
    public function getId()
34
    {
35 1
        return (int) $this->id;
36
    }
37
38 1
    public function getAspectRatio()
39
    {
40 1
        return $this->aspect_ratio;
41
    }
42
43 1
    public function getFilePath()
44
    {
45 1
        return $this->file_path;
46
    }
47
48 1
    public function getHeight()
49
    {
50 1
        return $this->height;
51
    }
52
53 1
    public function getIso6391()
54
    {
55 1
        return $this->iso_639_1;
56
    }
57
58 1
    public function getVoteAverage()
59
    {
60 1
        return $this->vote_average;
61
    }
62
63 1
    public function getVoteCount()
64
    {
65 1
        return $this->vote_count;
66
    }
67
68 1
    public function getWidth()
69
    {
70 1
        return $this->width;
71
    }
72
73
}
74