1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace vfalies\tmdb\Items; |
4
|
|
|
|
5
|
|
|
class TVShow extends Item implements \vfalies\tmdb\Interfaces\TVShowInterface |
6
|
|
|
{ |
7
|
|
|
|
8
|
28 |
|
public function __construct(\vfalies\tmdb\Tmdb $tmdb, int $tv_id, array $options = array()) |
9
|
|
|
{ |
10
|
28 |
|
parent::__construct($tmdb, $tv_id, $options, 'tv'); |
11
|
27 |
|
} |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Get TV show id |
15
|
|
|
* @return int |
16
|
|
|
*/ |
17
|
1 |
|
public function getId(): int |
18
|
|
|
{ |
19
|
1 |
|
return $this->id; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Get TVSHow genres |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
2 |
|
public function getGenres(): array |
27
|
|
|
{ |
28
|
2 |
|
if (isset($this->data->genres)) |
29
|
|
|
{ |
30
|
1 |
|
return $this->data->genres; |
31
|
|
|
} |
32
|
1 |
|
return []; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Get TVshow note |
37
|
|
|
* @return float |
38
|
|
|
*/ |
39
|
2 |
|
public function getNote(): float |
40
|
|
|
{ |
41
|
2 |
|
if (isset($this->data->vote_average)) |
42
|
|
|
{ |
43
|
1 |
|
return $this->data->vote_average; |
44
|
|
|
} |
45
|
1 |
|
return 0; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get TVshow number of episodes |
50
|
|
|
* @return int |
51
|
|
|
*/ |
52
|
2 |
|
public function getNumberEpisodes(): int |
53
|
|
|
{ |
54
|
2 |
|
if (isset($this->data->number_of_episodes)) |
55
|
|
|
{ |
56
|
1 |
|
return $this->data->number_of_episodes; |
57
|
|
|
} |
58
|
1 |
|
return 0; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get TVShow number of seasons |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
2 |
|
public function getNumberSeasons(): int |
66
|
|
|
{ |
67
|
2 |
|
if (isset($this->data->number_of_seasons)) |
68
|
|
|
{ |
69
|
1 |
|
return $this->data->number_of_seasons; |
70
|
|
|
} |
71
|
1 |
|
return 0; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get TVShow original title |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
2 |
|
public function getOriginalTitle(): string |
79
|
|
|
{ |
80
|
2 |
|
if (isset($this->data->original_name)) |
81
|
|
|
{ |
82
|
1 |
|
return $this->data->original_name; |
83
|
|
|
} |
84
|
1 |
|
return ''; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Get TVShow overview |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
2 |
|
public function getOverview(): string |
92
|
|
|
{ |
93
|
2 |
|
if (isset($this->data->overview)) |
94
|
|
|
{ |
95
|
1 |
|
return $this->data->overview; |
96
|
|
|
} |
97
|
1 |
|
return ''; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Get TVShow release date |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
2 |
|
public function getReleaseDate(): string |
105
|
|
|
{ |
106
|
2 |
|
if (isset($this->data->first_air_date)) |
107
|
|
|
{ |
108
|
1 |
|
return $this->data->first_air_date; |
109
|
|
|
} |
110
|
1 |
|
return ''; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get TVShow status |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
2 |
|
public function getStatus(): string |
118
|
|
|
{ |
119
|
2 |
|
if (isset($this->data->status)) |
120
|
|
|
{ |
121
|
1 |
|
return $this->data->status; |
122
|
|
|
} |
123
|
1 |
|
return ''; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get TVShow title |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
2 |
|
public function getTitle(): string |
131
|
|
|
{ |
132
|
2 |
|
if (isset($this->data->name)) |
133
|
|
|
{ |
134
|
1 |
|
return $this->data->name; |
135
|
|
|
} |
136
|
1 |
|
return ''; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Get TVShow seasons |
141
|
|
|
* @return \Generator |
142
|
|
|
* @throws \Exception |
143
|
|
|
*/ |
144
|
|
|
public function getSeasons() : \Generator |
145
|
|
|
{ |
146
|
|
|
throw new \Exception('Not yet implemented'); |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|