1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the pexels-library package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Library\Pexels\Model; |
13
|
|
|
|
14
|
|
|
use WBW\Library\Traits\Strings\StringRawDataTrait; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Video. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb> |
20
|
|
|
* @package WBW\Library\Pexels\Model |
21
|
|
|
*/ |
22
|
|
|
class Video extends AbstractMedia { |
23
|
|
|
|
24
|
|
|
use StringRawDataTrait; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Duration. |
28
|
|
|
* |
29
|
|
|
* @var int|null |
30
|
|
|
*/ |
31
|
|
|
private $duration; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Full res. |
35
|
|
|
* |
36
|
|
|
* @var mixed |
37
|
|
|
*/ |
38
|
|
|
private $fullRes; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Image. |
42
|
|
|
* |
43
|
|
|
* @var string|null |
44
|
|
|
*/ |
45
|
|
|
private $image; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* User. |
49
|
|
|
* |
50
|
|
|
* @var User|null |
51
|
|
|
*/ |
52
|
|
|
private $user; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Video files. |
56
|
|
|
* |
57
|
|
|
* @var VideoFile[] |
58
|
|
|
*/ |
59
|
|
|
private $videoFiles; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Video pictures. |
63
|
|
|
* |
64
|
|
|
* @var VideoPicture[] |
65
|
|
|
*/ |
66
|
|
|
private $videoPictures; |
67
|
60 |
|
|
68
|
60 |
|
/** |
69
|
|
|
* Constructor. |
70
|
60 |
|
*/ |
71
|
60 |
|
public function __construct() { |
72
|
60 |
|
parent::__construct(); |
73
|
|
|
|
74
|
|
|
$this->setVideoFiles([]); |
75
|
|
|
$this->setVideoPictures([]); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Add a video file. |
80
|
20 |
|
* |
81
|
20 |
|
* @param VideoFile $videoFile The video file. |
82
|
20 |
|
* @return Video Returns this video. |
83
|
|
|
*/ |
84
|
|
|
public function addVideoFile(VideoFile $videoFile): Video { |
85
|
|
|
$this->videoFiles[] = $videoFile; |
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Add a video picture. |
91
|
20 |
|
* |
92
|
20 |
|
* @param VideoPicture $videoPicture The video picture. |
93
|
20 |
|
* @return Video Returns this video. |
94
|
|
|
*/ |
95
|
|
|
public function addVideoPicture(VideoPicture $videoPicture): Video { |
96
|
|
|
$this->videoPictures[] = $videoPicture; |
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
20 |
|
* Get the duration. |
102
|
20 |
|
* |
103
|
|
|
* @return int|null Returns the duration. |
104
|
|
|
*/ |
105
|
|
|
public function getDuration(): ?int { |
106
|
|
|
return $this->duration; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
20 |
|
* Get the full res. |
111
|
20 |
|
* |
112
|
|
|
* @return mixed Returns the full res. |
113
|
|
|
*/ |
114
|
|
|
public function getFullRes() { |
115
|
|
|
return $this->fullRes; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
20 |
|
* Get the image. |
120
|
20 |
|
* |
121
|
|
|
* @return string|null Returns the image. |
122
|
|
|
*/ |
123
|
|
|
public function getImage(): ?string { |
124
|
|
|
return $this->image; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
15 |
|
* Get the user. |
129
|
15 |
|
* |
130
|
|
|
* @return User|null Returns the user. |
131
|
|
|
*/ |
132
|
|
|
public function getUser(): ?User { |
133
|
|
|
return $this->user; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
20 |
|
* Get the video files. |
138
|
20 |
|
* |
139
|
|
|
* @return VideoFile[] Returns teh video files. |
140
|
|
|
*/ |
141
|
|
|
public function getVideoFiles(): array { |
142
|
|
|
return $this->videoFiles; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
20 |
|
* Get the video pictures. |
147
|
20 |
|
* |
148
|
|
|
* @return VideoPicture[] Returns teh video pictures. |
149
|
|
|
*/ |
150
|
|
|
public function getVideoPictures(): array { |
151
|
|
|
return $this->videoPictures; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Set the duration. |
156
|
20 |
|
* |
157
|
20 |
|
* @param int|null $duration The duration. |
158
|
20 |
|
* @return Video Returns this video. |
159
|
|
|
*/ |
160
|
|
|
public function setDuration(?int $duration): Video { |
161
|
|
|
$this->duration = $duration; |
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Set the full re. |
167
|
20 |
|
* |
168
|
20 |
|
* @param mixed $fullRes The full res. |
169
|
20 |
|
* @return Video Returns this video. |
170
|
|
|
*/ |
171
|
|
|
public function setFullRes($fullRes): Video { |
172
|
|
|
$this->fullRes = $fullRes; |
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Set the image. |
178
|
20 |
|
* |
179
|
20 |
|
* @param string|null $image The image. |
180
|
20 |
|
* @return Video Returns this video. |
181
|
|
|
*/ |
182
|
|
|
public function setImage(?string $image): Video { |
183
|
|
|
$this->image = $image; |
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Set the user. |
189
|
20 |
|
* |
190
|
20 |
|
* @param User|null $user The user. |
191
|
20 |
|
* @return Video Returns this video. |
192
|
|
|
*/ |
193
|
|
|
public function setUser(?User $user): Video { |
194
|
|
|
$this->user = $user; |
195
|
|
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Set the video files. |
200
|
60 |
|
* |
201
|
60 |
|
* @param VideoFile[] $videoFiles The video files. |
202
|
60 |
|
* @return Video Returns this video. |
203
|
|
|
*/ |
204
|
|
|
protected function setVideoFiles(array $videoFiles): Video { |
205
|
|
|
$this->videoFiles = $videoFiles; |
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Set the video pictures. |
211
|
60 |
|
* |
212
|
60 |
|
* @param VideoPicture[] $videoPictures The video pictures. |
213
|
60 |
|
* @return Video Returns this video. |
214
|
|
|
*/ |
215
|
|
|
protected function setVideoPictures(array $videoPictures): Video { |
216
|
|
|
$this->videoPictures = $videoPictures; |
217
|
|
|
return $this; |
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|