Passed
Push — master ( ddfb88...ea9ad4 )
by vincent
41s
created

src/Results/TVEpisode.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5
use vfalies\tmdb\Abstracts\Results;
6
use vfalies\tmdb\Tmdb;
7
use vfalies\tmdb\Interfaces\Results\TVEpisodeResultsInterface;
8
use vfalies\tmdb\Exceptions\NotYetImplementedException;
9
use vfalies\tmdb\Traits\ElementTrait;
10
11
class TVEpisode extends Results implements TVEpisodeResultsInterface
12
{
13
    use ElementTrait;
14
15
    protected $episode_number  = 0;
16
    protected $name            = '';
17
    protected $air_date        = null;
18
    protected $season_number   = 0;
19
    protected $vote_average    = 0;
20
    protected $vote_count      = 0;
21
    protected $overview        = '';
22
    protected $production_code = '';
23
    protected $still_path      = '';
24
25
    /**
26
     * Constructor
27
     * @param \vfalies\tmdb\Tmdb $tmdb
28
     * @param \stdClass $result
29
     * @throws \Exception
30
     */
31 11
    public function __construct(Tmdb $tmdb, \stdClass $result)
32
    {
33 11
        parent::__construct($tmdb, $result);
34
35
        // Populate data
36 11
        $this->id              = $this->data->id;
0 ignored issues
show
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...
37 11
        $this->air_date        = $this->data->air_date;
38 11
        $this->season_number   = $this->data->season_number;
39 11
        $this->episode_number  = $this->data->episode_number;
40 11
        $this->name            = $this->data->name;
41 11
        $this->vote_average    = $this->data->vote_average;
42 11
        $this->vote_count      = $this->data->vote_count;
43 11
        $this->overview        = $this->data->overview;
44 11
        $this->production_code = $this->data->production_code;
45 11
        $this->still_path      = $this->data->still_path;
46 11
    }
47
48 1
    public function getAirDate()
49
    {
50 1
        return $this->air_date;
51
    }
52
53
    /**
54
     * @codeCoverageIgnore
55
     * @throws NotYetImplementedException
56
     */
57
    public function getCrew()
58
    {
59
        throw new NotYetImplementedException;
60
    }
61
62 1
    public function getEpisodeNumber()
63
    {
64 1
        return (int) $this->episode_number;
65
    }
66
67
    /**
68
     * @codeCoverageIgnore
69
     * @throws NotYetImplementedException
70
     */
71
    public function getGuestStars()
72
    {
73
        throw new NotYetImplementedException;
74
    }
75
76 1
    public function getId()
77
    {
78 1
        return (int) $this->id;
79
    }
80
81 1
    public function getName()
82
    {
83 1
        return $this->name;
84
    }
85
86 1
    public function getNote()
87
    {
88 1
        return $this->vote_average;
89
    }
90
91 1
    public function getNoteCount()
92
    {
93 1
        return (int) $this->vote_count;
94
    }
95
96 1
    public function getOverview()
97
    {
98 1
        return $this->overview;
99
    }
100
101 1
    public function getProductionCode()
102
    {
103 1
        return $this->production_code;
104
    }
105
106 1
    public function getSeasonNumber()
107
    {
108 1
        return (int) $this->season_number;
109
    }
110
111 1
    public function getStillPath()
112
    {
113 1
        return $this->still_path;
114
    }
115
116
}
117