X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fzendframework%2Fzend-feed%2Fsrc%2FWriter%2FExtension%2FGooglePlayPodcast%2FEntry.php;fp=vendor%2Fzendframework%2Fzend-feed%2Fsrc%2FWriter%2FExtension%2FGooglePlayPodcast%2FEntry.php;h=1110c94657cc976a2fb4eba2e8c2c829e1a7bcfc;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php new file mode 100644 index 000000000..1110c9465 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php @@ -0,0 +1,150 @@ +stringWrapper = StringUtils::getWrapper($this->encoding); + } + + /** + * Set feed encoding + * + * @param string $enc + * @return Entry + */ + public function setEncoding($enc) + { + $this->stringWrapper = StringUtils::getWrapper($enc); + $this->encoding = $enc; + return $this; + } + + /** + * Get feed encoding + * + * @return string + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Set a block value of "yes" or "no". You may also set an empty string. + * + * @param string + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastBlock($value) + { + if (! ctype_alpha($value) && strlen($value) > 0) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain alphabetic characters' + ); + } + + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain a maximum of 255 characters' + ); + } + $this->data['block'] = $value; + } + + /** + * Set "explicit" flag + * + * @param bool $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastExplicit($value) + { + if (! in_array($value, ['yes', 'no', 'clean'], true)) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "explicit" may only be one of "yes", "no" or "clean"' + ); + } + $this->data['explicit'] = $value; + return $this; + } + + /** + * Set episode description + * + * @param string $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastDescription($value) + { + if ($this->stringWrapper->strlen($value) > 4000) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "description" may only contain a maximum of 4000 characters' + ); + } + $this->data['description'] = $value; + return $this; + } + + /** + * Overloading to itunes specific setters + * + * @param string $method + * @param array $params + * @throws Writer\Exception\BadMethodCallException + * @return mixed + */ + public function __call($method, array $params) + { + $point = lcfirst(substr($method, 14)); + if (! method_exists($this, 'setPlayPodcast' . ucfirst($point)) + && ! method_exists($this, 'addPlayPodcast' . ucfirst($point)) + ) { + throw new Writer\Exception\BadMethodCallException( + 'invalid method: ' . $method + ); + } + if (! array_key_exists($point, $this->data) + || empty($this->data[$point]) + ) { + return; + } + return $this->data[$point]; + } +}