Mercurial > hg > isophonics-drupal-site
comparison vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 7a779792577d |
children |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
167 * @return Feed | 167 * @return Feed |
168 * @throws Writer\Exception\InvalidArgumentException | 168 * @throws Writer\Exception\InvalidArgumentException |
169 */ | 169 */ |
170 public function setItunesImage($value) | 170 public function setItunesImage($value) |
171 { | 171 { |
172 if (! Uri::factory($value)->isValid()) { | 172 if (! is_string($value) || ! Uri::factory($value)->isValid()) { |
173 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' | 173 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' |
174 . ' be a valid URI/IRI'); | 174 . ' be a valid URI/IRI'); |
175 } | 175 } |
176 if (! in_array(substr($value, -3), ['jpg', 'png'])) { | 176 if (! in_array(substr($value, -3), ['jpg', 'png'])) { |
177 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' | 177 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' |
221 } | 221 } |
222 | 222 |
223 /** | 223 /** |
224 * Set feed keywords | 224 * Set feed keywords |
225 * | 225 * |
226 * @deprecated since 2.10.0; itunes:keywords is no longer part of the | |
227 * iTunes podcast RSS specification. | |
226 * @param array $value | 228 * @param array $value |
227 * @return Feed | 229 * @return Feed |
228 * @throws Writer\Exception\InvalidArgumentException | 230 * @throws Writer\Exception\InvalidArgumentException |
229 */ | 231 */ |
230 public function setItunesKeywords(array $value) | 232 public function setItunesKeywords(array $value) |
231 { | 233 { |
234 trigger_error( | |
235 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' | |
236 . ' and should not be relied on.', | |
237 \E_USER_DEPRECATED | |
238 ); | |
239 | |
232 if (count($value) > 12) { | 240 if (count($value) > 12) { |
233 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' | 241 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' |
234 . ' contain a maximum of 12 terms'); | 242 . ' contain a maximum of 12 terms'); |
235 } | 243 } |
236 $concat = implode(',', $value); | 244 $concat = implode(',', $value); |
329 if ($this->stringWrapper->strlen($value) > 4000) { | 337 if ($this->stringWrapper->strlen($value) > 4000) { |
330 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "summary" may only' | 338 throw new Writer\Exception\InvalidArgumentException('invalid parameter: "summary" may only' |
331 . ' contain a maximum of 4000 characters'); | 339 . ' contain a maximum of 4000 characters'); |
332 } | 340 } |
333 $this->data['summary'] = $value; | 341 $this->data['summary'] = $value; |
342 return $this; | |
343 } | |
344 | |
345 /** | |
346 * Set podcast type | |
347 * | |
348 * @param string $type | |
349 * @return Feed | |
350 * @throws Writer\Exception\InvalidArgumentException | |
351 */ | |
352 public function setItunesType($type) | |
353 { | |
354 $validTypes = ['episodic', 'serial']; | |
355 if (! in_array($type, $validTypes, true)) { | |
356 throw new Writer\Exception\InvalidArgumentException(sprintf( | |
357 'invalid parameter: "type" MUST be one of [%s]; received %s', | |
358 implode(', ', $validTypes), | |
359 is_object($type) ? get_class($type) : var_export($type, true) | |
360 )); | |
361 } | |
362 $this->data['type'] = $type; | |
363 return $this; | |
364 } | |
365 | |
366 /** | |
367 * Set "completion" status (whether more episodes will be released) | |
368 * | |
369 * @param bool $status | |
370 * @return Feed | |
371 * @throws Writer\Exception\InvalidArgumentException | |
372 */ | |
373 public function setItunesComplete($status) | |
374 { | |
375 if (! is_bool($status)) { | |
376 throw new Writer\Exception\InvalidArgumentException(sprintf( | |
377 'invalid parameter: "complete" MUST be boolean; received %s', | |
378 is_object($status) ? get_class($status) : var_export($status, true) | |
379 )); | |
380 } | |
381 | |
382 if (! $status) { | |
383 return $this; | |
384 } | |
385 | |
386 $this->data['complete'] = 'Yes'; | |
334 return $this; | 387 return $this; |
335 } | 388 } |
336 | 389 |
337 /** | 390 /** |
338 * Overloading: proxy to internal setters | 391 * Overloading: proxy to internal setters |
350 ) { | 403 ) { |
351 throw new Writer\Exception\BadMethodCallException( | 404 throw new Writer\Exception\BadMethodCallException( |
352 'invalid method: ' . $method | 405 'invalid method: ' . $method |
353 ); | 406 ); |
354 } | 407 } |
408 | |
355 if (! array_key_exists($point, $this->data) || empty($this->data[$point])) { | 409 if (! array_key_exists($point, $this->data) || empty($this->data[$point])) { |
356 return; | 410 return; |
357 } | 411 } |
358 return $this->data[$point]; | 412 return $this->data[$point]; |
359 } | 413 } |