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