Chris@16: stringWrapper = StringUtils::getWrapper($this->encoding); Chris@16: } Chris@16: Chris@16: /** Chris@16: * Set feed encoding Chris@16: * Chris@16: * @param string $enc Chris@16: * @return Entry Chris@16: */ Chris@16: public function setEncoding($enc) Chris@16: { Chris@16: $this->stringWrapper = StringUtils::getWrapper($enc); Chris@16: $this->encoding = $enc; Chris@16: return $this; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Get feed encoding Chris@16: * Chris@16: * @return string Chris@16: */ Chris@16: public function getEncoding() Chris@16: { Chris@16: return $this->encoding; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Set a block value of "yes" or "no". You may also set an empty string. Chris@16: * Chris@16: * @param string Chris@16: * @throws Writer\Exception\InvalidArgumentException Chris@16: */ Chris@16: public function setPlayPodcastBlock($value) Chris@16: { Chris@16: if (! ctype_alpha($value) && strlen($value) > 0) { Chris@16: throw new Writer\Exception\InvalidArgumentException( Chris@16: 'invalid parameter: "block" may only contain alphabetic characters' Chris@16: ); Chris@16: } Chris@16: Chris@16: if ($this->stringWrapper->strlen($value) > 255) { Chris@16: throw new Writer\Exception\InvalidArgumentException( Chris@16: 'invalid parameter: "block" may only contain a maximum of 255 characters' Chris@16: ); Chris@16: } Chris@16: $this->data['block'] = $value; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Set "explicit" flag Chris@16: * Chris@16: * @param bool $value Chris@16: * @return Entry Chris@16: * @throws Writer\Exception\InvalidArgumentException Chris@16: */ Chris@16: public function setPlayPodcastExplicit($value) Chris@16: { Chris@16: if (! in_array($value, ['yes', 'no', 'clean'], true)) { Chris@16: throw new Writer\Exception\InvalidArgumentException( Chris@16: 'invalid parameter: "explicit" may only be one of "yes", "no" or "clean"' Chris@16: ); Chris@16: } Chris@16: $this->data['explicit'] = $value; Chris@16: return $this; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Set episode description Chris@16: * Chris@16: * @param string $value Chris@16: * @return Entry Chris@16: * @throws Writer\Exception\InvalidArgumentException Chris@16: */ Chris@16: public function setPlayPodcastDescription($value) Chris@16: { Chris@16: if ($this->stringWrapper->strlen($value) > 4000) { Chris@16: throw new Writer\Exception\InvalidArgumentException( Chris@16: 'invalid parameter: "description" may only contain a maximum of 4000 characters' Chris@16: ); Chris@16: } Chris@16: $this->data['description'] = $value; Chris@16: return $this; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Overloading to itunes specific setters Chris@16: * Chris@16: * @param string $method Chris@16: * @param array $params Chris@16: * @throws Writer\Exception\BadMethodCallException Chris@16: * @return mixed Chris@16: */ Chris@16: public function __call($method, array $params) Chris@16: { Chris@16: $point = lcfirst(substr($method, 14)); Chris@16: if (! method_exists($this, 'setPlayPodcast' . ucfirst($point)) Chris@16: && ! method_exists($this, 'addPlayPodcast' . ucfirst($point)) Chris@16: ) { Chris@16: throw new Writer\Exception\BadMethodCallException( Chris@16: 'invalid method: ' . $method Chris@16: ); Chris@16: } Chris@16: if (! array_key_exists($point, $this->data) Chris@16: || empty($this->data[$point]) Chris@16: ) { Chris@16: return; Chris@16: } Chris@16: return $this->data[$point]; Chris@16: } Chris@16: }