1 | <?php |
||
26 | class ArticleMedia implements ArticleMediaInterface |
||
27 | { |
||
28 | use TimestampableTrait; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $id; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $key; |
||
39 | |||
40 | /** |
||
41 | * @var FileInterface |
||
42 | */ |
||
43 | protected $file; |
||
44 | |||
45 | /** |
||
46 | * @var ImageInterface |
||
47 | */ |
||
48 | protected $image; |
||
49 | |||
50 | /** |
||
51 | * @var ArticleInterface |
||
52 | */ |
||
53 | protected $article; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $description; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $located; |
||
64 | |||
65 | /** |
||
66 | * @var string |
||
67 | */ |
||
68 | protected $byLine; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $body; |
||
74 | |||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $mimetype; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | */ |
||
83 | protected $usageTerms; |
||
84 | |||
85 | /** |
||
86 | * @var ArrayCollection |
||
87 | */ |
||
88 | protected $renditions; |
||
89 | |||
90 | /** |
||
91 | * ArticleMedia constructor. |
||
92 | */ |
||
93 | public function __construct() |
||
94 | { |
||
95 | $this->renditions = new ArrayCollection(); |
||
96 | $this->setCreatedAt(new \DateTime()); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return ArrayCollection |
||
101 | */ |
||
102 | public function getRenditions() |
||
103 | { |
||
104 | return $this->renditions; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @param ImageRendition $rendition |
||
109 | */ |
||
110 | public function addRendition(ImageRendition $rendition) |
||
111 | { |
||
112 | $this->renditions->add($rendition); |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @param ArrayCollection $renditions |
||
117 | */ |
||
118 | public function setRenditions($renditions) |
||
119 | { |
||
120 | $this->renditions = $renditions; |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | public function getId() |
||
127 | { |
||
128 | return $this->id; |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | public function getFile() |
||
138 | |||
139 | /** |
||
140 | * @param FileInterface $file |
||
141 | * |
||
142 | * @return ArticleMedia |
||
143 | */ |
||
144 | public function setFile($file) |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function getImage() |
||
158 | |||
159 | /** |
||
160 | * @param ImageInterface $image |
||
161 | * |
||
162 | * @return ArticleMedia |
||
163 | */ |
||
164 | public function setImage($image) |
||
170 | |||
171 | /** |
||
172 | * {@inheritdoc} |
||
173 | */ |
||
174 | public function getArticle() |
||
178 | |||
179 | /** |
||
180 | * @param ArticleInterface $article |
||
181 | * |
||
182 | * @return ArticleMedia |
||
183 | */ |
||
184 | public function setArticle(ArticleInterface $article) |
||
190 | |||
191 | public function getAssetId() |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | public function getDescription() |
||
209 | |||
210 | /** |
||
211 | * @param string $description |
||
212 | * |
||
213 | * @return ArticleMedia |
||
214 | */ |
||
215 | public function setDescription($description) |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | public function getLocated() |
||
229 | |||
230 | /** |
||
231 | * @param string $located |
||
232 | * |
||
233 | * @return ArticleMedia |
||
234 | */ |
||
235 | public function setLocated($located) |
||
241 | |||
242 | /** |
||
243 | * {@inheritdoc} |
||
244 | */ |
||
245 | public function getByLine() |
||
249 | |||
250 | /** |
||
251 | * @param string $byLine |
||
252 | * |
||
253 | * @return ArticleMedia |
||
254 | */ |
||
255 | public function setByLine($byLine) |
||
261 | |||
262 | /** |
||
263 | * {@inheritdoc} |
||
264 | */ |
||
265 | public function getBody() |
||
269 | |||
270 | /** |
||
271 | * @param string $body |
||
272 | * |
||
273 | * @return ArticleMedia |
||
274 | */ |
||
275 | public function setBody($body) |
||
281 | |||
282 | /** |
||
283 | * @return string |
||
284 | */ |
||
285 | public function getMimetype() |
||
289 | |||
290 | /** |
||
291 | * @param string $mimetype |
||
292 | * |
||
293 | * @return ArticleMedia |
||
294 | */ |
||
295 | public function setMimetype($mimetype) |
||
301 | |||
302 | /** |
||
303 | * @return mixed |
||
304 | */ |
||
305 | public function getUsageTerms() |
||
309 | |||
310 | /** |
||
311 | * @param mixed $usageTerms |
||
312 | * |
||
313 | * @return ArticleMedia |
||
314 | */ |
||
315 | public function setUsageTerms($usageTerms) |
||
321 | |||
322 | /** |
||
323 | * @return string |
||
324 | */ |
||
325 | public function getKey(): string |
||
329 | |||
330 | /** |
||
331 | * @param string $key |
||
332 | */ |
||
333 | public function setKey(string $key) |
||
337 | |||
338 | /** |
||
339 | * @param ItemInterface $item |
||
340 | */ |
||
341 | public function setFromItem(ItemInterface $item) |
||
349 | |||
350 | /** |
||
351 | * {@inheritdoc} |
||
352 | */ |
||
353 | public static function handleMediaId($mediaId) |
||
363 | } |
||
364 |