Mercurial > hg > isophonics-drupal-site
diff vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php Tue Jul 10 15:07:59 2018 +0100 @@ -9,6 +9,7 @@ namespace Zend\Feed\Writer\Extension\ITunes; +use Zend\Feed\Uri; use Zend\Feed\Writer; use Zend\Stdlib\StringUtils; use Zend\Stdlib\StringWrapper\StringWrapperInterface; @@ -162,12 +163,20 @@ /** * Set keywords * + * @deprecated since 2.10.0; itunes:keywords is no longer part of the + * iTunes podcast RSS specification. * @param array $value * @return Entry * @throws Writer\Exception\InvalidArgumentException */ public function setItunesKeywords(array $value) { + trigger_error( + 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' + . ' and should not be relied on.', + \E_USER_DEPRECATED + ); + if (count($value) > 12) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); @@ -218,6 +227,123 @@ } /** + * Set entry image (icon) + * + * @param string $value + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesImage($value) + { + if (! is_string($value) || ! Uri::factory($value)->isValid()) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "image" may only be a valid URI/IRI' + ); + } + + if (! in_array(substr($value, -3), ['jpg', 'png'])) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "image" may only use file extension "jpg"' + . ' or "png" which must be the last three characters of the URI' + . ' (i.e. no query string or fragment)' + ); + } + + $this->data['image'] = $value; + return $this; + } + + /** + * Set the episode number + * + * @param int $number + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesEpisode($number) + { + if (! is_numeric($number) || is_float($number)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "number" may only be an integer; received %s', + is_object($number) ? get_class($number) : gettype($number) + )); + } + + $this->data['episode'] = (int) $number; + + return $this; + } + + /** + * Set the episode type + * + * @param string $type One of "full", "trailer", or "bonus". + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesEpisodeType($type) + { + $validTypes = ['full', 'trailer', 'bonus']; + if (! in_array($type, $validTypes, true)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "episodeType" MUST be one of the strings [%s]; received %s', + implode(', ', $validTypes), + is_object($type) ? get_class($type) : var_export($type, true) + )); + } + + $this->data['episodeType'] = $type; + + return $this; + } + + /** + * Set the status of closed captioning + * + * @param bool $status + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesIsClosedCaptioned($status) + { + if (! is_bool($status)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "isClosedCaptioned" MUST be a boolean; received %s', + is_object($status) ? get_class($status) : var_export($status, true) + )); + } + + if (! $status) { + return $this; + } + + $this->data['isClosedCaptioned'] = true; + + return $this; + } + + /** + * Set the season number to which the episode belongs + * + * @param int $number + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesSeason($number) + { + if (! is_numeric($number) || is_float($number)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "season" may only be an integer; received %s', + is_object($number) ? get_class($number) : gettype($number) + )); + } + + $this->data['season'] = (int) $number; + + return $this; + } + + /** * Overloading to itunes specific setters * * @param string $method