Test Failed
Pull Request — master (#17)
by
unknown
03:56
created

TVEpisode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

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