Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / zendframework / zend-feed / src / Writer / Extension / ITunes / Feed.php
index 2acf80fc9be99a841608ba0a1b680122682698d1..3aa30995b01d6605935300b12d719138cc087077 100644 (file)
@@ -169,7 +169,7 @@ class Feed
      */
     public function setItunesImage($value)
     {
-        if (! Uri::factory($value)->isValid()) {
+        if (! is_string($value) || ! Uri::factory($value)->isValid()) {
             throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only'
             . ' be a valid URI/IRI');
         }
@@ -223,12 +223,20 @@ class Feed
     /**
      * Set feed keywords
      *
+     * @deprecated since 2.10.0; itunes:keywords is no longer part of the
+     *     iTunes podcast RSS specification.
      * @param  array $value
      * @return Feed
      * @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');
@@ -334,6 +342,51 @@ class Feed
         return $this;
     }
 
+    /**
+     * Set podcast type
+     *
+     * @param  string $type
+     * @return Feed
+     * @throws Writer\Exception\InvalidArgumentException
+     */
+    public function setItunesType($type)
+    {
+        $validTypes = ['episodic', 'serial'];
+        if (! in_array($type, $validTypes, true)) {
+            throw new Writer\Exception\InvalidArgumentException(sprintf(
+                'invalid parameter: "type" MUST be one of [%s]; received %s',
+                implode(', ', $validTypes),
+                is_object($type) ? get_class($type) : var_export($type, true)
+            ));
+        }
+        $this->data['type'] = $type;
+        return $this;
+    }
+
+    /**
+     * Set "completion" status (whether more episodes will be released)
+     *
+     * @param  bool $status
+     * @return Feed
+     * @throws Writer\Exception\InvalidArgumentException
+     */
+    public function setItunesComplete($status)
+    {
+        if (! is_bool($status)) {
+            throw new Writer\Exception\InvalidArgumentException(sprintf(
+                'invalid parameter: "complete" MUST be boolean; received %s',
+                is_object($status) ? get_class($status) : var_export($status, true)
+            ));
+        }
+
+        if (! $status) {
+            return $this;
+        }
+
+        $this->data['complete'] = 'Yes';
+        return $this;
+    }
+
     /**
      * Overloading: proxy to internal setters
      *
@@ -352,6 +405,7 @@ class Feed
                 'invalid method: ' . $method
             );
         }
+
         if (! array_key_exists($point, $this->data) || empty($this->data[$point])) {
             return;
         }