|
1
|
|
|
<?php declare(strict_types = 1); |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the Tmdb package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Vincent Faliès <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
* |
|
10
|
|
|
* @author Vincent Faliès <[email protected]> |
|
11
|
|
|
* @copyright Copyright (c) 2017-2020 |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
namespace VfacTmdb\Results; |
|
16
|
|
|
|
|
17
|
|
|
use VfacTmdb\Abstracts\Results; |
|
18
|
|
|
use VfacTmdb\Interfaces\Results\VideosResultsInterface; |
|
19
|
|
|
use VfacTmdb\Interfaces\TmdbInterface; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class to manipulate a videos result |
|
23
|
|
|
* @package Tmdb |
|
24
|
|
|
* @author Vincent Faliès <[email protected]> |
|
25
|
|
|
* @copyright Copyright (c) 2017-2020 |
|
26
|
|
|
*/ |
|
27
|
|
|
class Videos extends Results implements VideosResultsInterface |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Iso_639_1 |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $iso_639_1 = null; |
|
34
|
|
|
/** |
|
35
|
|
|
* Iso_3166_1 |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $iso_3166_1 = null; |
|
39
|
|
|
/** |
|
40
|
|
|
* Key |
|
41
|
|
|
* @var string |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $key = null; |
|
44
|
|
|
/** |
|
45
|
|
|
* Name |
|
46
|
|
|
* @var string |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $name = null; |
|
49
|
|
|
/** |
|
50
|
|
|
* Site |
|
51
|
|
|
* @var string |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $site = null; |
|
54
|
|
|
/** |
|
55
|
|
|
* Id |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
protected $id = null; |
|
59
|
|
|
/** |
|
60
|
|
|
* Size |
|
61
|
|
|
* |
|
62
|
|
|
* @var int |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $size = null; |
|
65
|
|
|
/** |
|
66
|
|
|
* Type |
|
67
|
|
|
* |
|
68
|
|
|
* @var string |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $type = null; |
|
71
|
|
|
/** |
|
72
|
|
|
* Constructor |
|
73
|
|
|
* @param TmdbInterface $tmdb |
|
74
|
|
|
* @param \stdClass $result |
|
75
|
|
|
*/ |
|
76
|
3 |
|
public function __construct(TmdbInterface $tmdb, \stdClass $result) |
|
77
|
|
|
{ |
|
78
|
3 |
|
parent::__construct($tmdb, $result); |
|
79
|
|
|
|
|
80
|
3 |
|
$this->video_id = $this->data->id; |
|
|
|
|
|
|
81
|
3 |
|
$this->iso_639_1 = $this->data->iso_639_1; |
|
82
|
3 |
|
$this->iso_3166_1 = $this->data->iso_3166_1; |
|
83
|
3 |
|
$this->key = $this->data->key; |
|
84
|
3 |
|
$this->name = $this->data->name; |
|
85
|
3 |
|
$this->site = $this->data->site; |
|
86
|
3 |
|
$this->size = $this->data->size; |
|
87
|
3 |
|
$this->type = $this->data->type; |
|
88
|
3 |
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Get iso_639_1 |
|
92
|
|
|
* |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getIso_639_1() : string |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->iso_639_1; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Get iso_3166_1 |
|
102
|
|
|
* |
|
103
|
|
|
* @return string |
|
104
|
|
|
*/ |
|
105
|
|
|
public function getIso_3166_1() : string |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->iso_3166_1; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Get key |
|
112
|
|
|
* |
|
113
|
|
|
* @return string |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getKey() : string |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->key; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Get name |
|
122
|
|
|
* |
|
123
|
|
|
* @return string |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getName() : string |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->name; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Get site |
|
132
|
|
|
* |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getSite() : string |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->site; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Get id |
|
142
|
|
|
* |
|
143
|
|
|
* @return string |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getVideoId() : string |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->video_id; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Get size |
|
152
|
|
|
* |
|
153
|
|
|
* @return int |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getSize() : int |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->size; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Get type |
|
162
|
|
|
* |
|
163
|
|
|
* @return string |
|
164
|
|
|
*/ |
|
165
|
|
|
public function getType() : string |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->type; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Get id |
|
172
|
|
|
* |
|
173
|
|
|
* @return int |
|
174
|
|
|
*/ |
|
175
|
|
|
public function getId() : ?int |
|
176
|
|
|
{ |
|
177
|
|
|
return null; |
|
178
|
|
|
} |
|
179
|
|
|
} |
|
180
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: