Mercurial > hg > cmmr2012-drupal-site
diff vendor/zendframework/zend-feed/src/Writer/Entry.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | c75dbcec494b |
children | a9cd425dd02b |
line wrap: on
line diff
--- a/vendor/zendframework/zend-feed/src/Writer/Entry.php Thu Jul 05 15:32:06 2018 +0100 +++ b/vendor/zendframework/zend-feed/src/Writer/Entry.php Tue Jul 10 13:19:18 2018 +0000 @@ -64,26 +64,29 @@ public function addAuthor(array $author) { // Check array values - if (!array_key_exists('name', $author) + if (! array_key_exists('name', $author) || empty($author['name']) - || !is_string($author['name']) + || ! is_string($author['name']) ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: author array must include a "name" key with a non-empty string value'); + 'Invalid parameter: author array must include a "name" key with a non-empty string value' + ); } if (isset($author['email'])) { - if (empty($author['email']) || !is_string($author['email'])) { + if (empty($author['email']) || ! is_string($author['email'])) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "email" array value must be a non-empty string'); + 'Invalid parameter: "email" array value must be a non-empty string' + ); } } if (isset($author['uri'])) { - if (empty($author['uri']) || !is_string($author['uri']) || - !Uri::factory($author['uri'])->isValid() + if (empty($author['uri']) || ! is_string($author['uri']) || + ! Uri::factory($author['uri'])->isValid() ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI' + ); } } @@ -117,7 +120,7 @@ */ public function setEncoding($encoding) { - if (empty($encoding) || !is_string($encoding)) { + if (empty($encoding) || ! is_string($encoding)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['encoding'] = $encoding; @@ -132,7 +135,7 @@ */ public function getEncoding() { - if (!array_key_exists('encoding', $this->data)) { + if (! array_key_exists('encoding', $this->data)) { return 'UTF-8'; } return $this->data['encoding']; @@ -147,7 +150,7 @@ */ public function setCopyright($copyright) { - if (empty($copyright) || !is_string($copyright)) { + if (empty($copyright) || ! is_string($copyright)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['copyright'] = $copyright; @@ -164,7 +167,7 @@ */ public function setContent($content) { - if (empty($content) || !is_string($content)) { + if (empty($content) || ! is_string($content)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['content'] = $content; @@ -185,8 +188,10 @@ $date = new DateTime(); } elseif (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { - throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); + } elseif (! $date instanceof DateTime) { + throw new Exception\InvalidArgumentException( + 'Invalid DateTime object or UNIX Timestamp passed as parameter' + ); } $this->data['dateCreated'] = $date; @@ -206,8 +211,10 @@ $date = new DateTime(); } elseif (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { - throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); + } elseif (! $date instanceof DateTime) { + throw new Exception\InvalidArgumentException( + 'Invalid DateTime object or UNIX Timestamp passed as parameter' + ); } $this->data['dateModified'] = $date; @@ -223,7 +230,7 @@ */ public function setDescription($description) { - if (empty($description) || !is_string($description)) { + if (empty($description) || ! is_string($description)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['description'] = $description; @@ -240,7 +247,7 @@ */ public function setId($id) { - if (empty($id) || !is_string($id)) { + if (empty($id) || ! is_string($id)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['id'] = $id; @@ -257,8 +264,10 @@ */ public function setLink($link) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' + ); } $this->data['link'] = $link; @@ -274,8 +283,10 @@ */ public function setCommentCount($count) { - if (!is_numeric($count) || (int) $count != $count || (int) $count < 0) { - throw new Exception\InvalidArgumentException('Invalid parameter: "count" must be a positive integer number or zero'); + if (! is_numeric($count) || (int) $count != $count || (int) $count < 0) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "count" must be a positive integer number or zero' + ); } $this->data['commentCount'] = (int) $count; @@ -291,8 +302,10 @@ */ public function setCommentLink($link) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "link" must be a non-empty string and valid URI/IRI' + ); } $this->data['commentLink'] = $link; @@ -308,14 +321,16 @@ */ public function setCommentFeedLink(array $link) { - if (!isset($link['uri']) || !is_string($link['uri']) || !Uri::factory($link['uri'])->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (! isset($link['uri']) || ! is_string($link['uri']) || ! Uri::factory($link['uri'])->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "link" must be a non-empty string and valid URI/IRI' + ); } - if (!isset($link['type']) || !in_array($link['type'], ['atom', 'rss', 'rdf'])) { + if (! isset($link['type']) || ! in_array($link['type'], ['atom', 'rss', 'rdf'])) { throw new Exception\InvalidArgumentException('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } - if (!isset($this->data['commentFeedLinks'])) { + if (! isset($this->data['commentFeedLinks'])) { $this->data['commentFeedLinks'] = []; } $this->data['commentFeedLinks'][] = $link; @@ -349,7 +364,7 @@ */ public function setTitle($title) { - if (empty($title) || !is_string($title)) { + if ((empty($title) && ! is_numeric($title)) || ! is_string($title)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['title'] = $title; @@ -364,7 +379,7 @@ */ public function getAuthors() { - if (!array_key_exists('authors', $this->data)) { + if (! array_key_exists('authors', $this->data)) { return; } return $this->data['authors']; @@ -377,7 +392,7 @@ */ public function getContent() { - if (!array_key_exists('content', $this->data)) { + if (! array_key_exists('content', $this->data)) { return; } return $this->data['content']; @@ -390,7 +405,7 @@ */ public function getCopyright() { - if (!array_key_exists('copyright', $this->data)) { + if (! array_key_exists('copyright', $this->data)) { return; } return $this->data['copyright']; @@ -403,7 +418,7 @@ */ public function getDateCreated() { - if (!array_key_exists('dateCreated', $this->data)) { + if (! array_key_exists('dateCreated', $this->data)) { return; } return $this->data['dateCreated']; @@ -416,7 +431,7 @@ */ public function getDateModified() { - if (!array_key_exists('dateModified', $this->data)) { + if (! array_key_exists('dateModified', $this->data)) { return; } return $this->data['dateModified']; @@ -429,7 +444,7 @@ */ public function getDescription() { - if (!array_key_exists('description', $this->data)) { + if (! array_key_exists('description', $this->data)) { return; } return $this->data['description']; @@ -442,7 +457,7 @@ */ public function getId() { - if (!array_key_exists('id', $this->data)) { + if (! array_key_exists('id', $this->data)) { return; } return $this->data['id']; @@ -455,7 +470,7 @@ */ public function getLink() { - if (!array_key_exists('link', $this->data)) { + if (! array_key_exists('link', $this->data)) { return; } return $this->data['link']; @@ -469,7 +484,7 @@ */ public function getLinks() { - if (!array_key_exists('links', $this->data)) { + if (! array_key_exists('links', $this->data)) { return; } return $this->data['links']; @@ -482,7 +497,7 @@ */ public function getTitle() { - if (!array_key_exists('title', $this->data)) { + if (! array_key_exists('title', $this->data)) { return; } return $this->data['title']; @@ -495,7 +510,7 @@ */ public function getCommentCount() { - if (!array_key_exists('commentCount', $this->data)) { + if (! array_key_exists('commentCount', $this->data)) { return; } return $this->data['commentCount']; @@ -508,7 +523,7 @@ */ public function getCommentLink() { - if (!array_key_exists('commentLink', $this->data)) { + if (! array_key_exists('commentLink', $this->data)) { return; } return $this->data['commentLink']; @@ -522,7 +537,7 @@ */ public function getCommentFeedLinks() { - if (!array_key_exists('commentFeedLinks', $this->data)) { + if (! array_key_exists('commentFeedLinks', $this->data)) { return; } return $this->data['commentFeedLinks']; @@ -537,21 +552,21 @@ */ public function addCategory(array $category) { - if (!isset($category['term'])) { + if (! isset($category['term'])) { throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Uri::factory($category['scheme'])->isValid() + || ! is_string($category['scheme']) + || ! Uri::factory($category['scheme'])->isValid() ) { throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } - if (!isset($this->data['categories'])) { + if (! isset($this->data['categories'])) { $this->data['categories'] = []; } $this->data['categories'][] = $category; @@ -581,7 +596,7 @@ */ public function getCategories() { - if (!array_key_exists('categories', $this->data)) { + if (! array_key_exists('categories', $this->data)) { return; } return $this->data['categories']; @@ -599,10 +614,10 @@ */ public function setEnclosure(array $enclosure) { - if (!isset($enclosure['uri'])) { + if (! isset($enclosure['uri'])) { throw new Exception\InvalidArgumentException('Enclosure "uri" is not set'); } - if (!Uri::factory($enclosure['uri'])->isValid()) { + if (! Uri::factory($enclosure['uri'])->isValid()) { throw new Exception\InvalidArgumentException('Enclosure "uri" is not a valid URI/IRI'); } $this->data['enclosure'] = $enclosure; @@ -617,7 +632,7 @@ */ public function getEnclosure() { - if (!array_key_exists('enclosure', $this->data)) { + if (! array_key_exists('enclosure', $this->data)) { return; } return $this->data['enclosure']; @@ -752,8 +767,10 @@ * * @return void */ + // @codingStandardsIgnoreStart protected function _loadExtensions() { + // @codingStandardsIgnoreEnd $all = Writer::getExtensions(); $manager = Writer::getExtensionManager(); $exts = $all['entry'];