Mercurial > hg > cmmr2012-drupal-site
diff vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.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/Renderer/Entry/Atom.php Thu Jul 05 15:32:06 2018 +0100 +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php Tue Jul 10 13:19:18 2018 +0000 @@ -56,7 +56,7 @@ foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $entry); + $ext->setDomDocument($this->getDomDocument(), $entry); $ext->render(); } @@ -71,13 +71,15 @@ * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:title element but a title has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -98,9 +100,11 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription()) { return; // unless src content or base64 } $subtitle = $dom->createElement('summary'); @@ -120,13 +124,15 @@ * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -149,9 +155,11 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } $el = $dom->createElement('published'); @@ -169,10 +177,12 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->container->getAuthors(); - if ((!$authors || empty($authors))) { + if ((! $authors || empty($authors))) { /** * This will actually trigger an Exception at the feed level if * a feed level author is not set. @@ -208,10 +218,12 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $data = $this->container->getEnclosure(); - if ((!$data || empty($data))) { + if ((! $data || empty($data))) { return; } $enclosure = $this->dom->createElement('link'); @@ -226,9 +238,11 @@ $root->appendChild($enclosure); } + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLink()) { return; } $link = $dom->createElement('link'); @@ -246,16 +260,18 @@ * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setId(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getId() + && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 entry elements MUST contain exactly one ' . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -263,17 +279,17 @@ } } - if (!$this->getDataContainer()->getId()) { + if (! $this->getDataContainer()->getId()) { $this->getDataContainer()->setId( $this->getDataContainer()->getLink() ); } - if (!Uri::factory($this->getDataContainer()->getId())->isValid() - && !preg_match( + if (! Uri::factory($this->getDataContainer()->getId())->isValid() + && ! preg_match( "#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId() ) - && !$this->_validateTagUri($this->getDataContainer()->getId()) + && ! $this->_validateTagUri($this->getDataContainer()->getId()) ) { throw new Writer\Exception\InvalidArgumentException('Atom 1.0 IDs must be a valid URI/IRI'); } @@ -289,8 +305,10 @@ * @param string $id * @return bool */ + // @codingStandardsIgnoreStart protected function _validateTagUri($id) { + // @codingStandardsIgnoreEnd if (preg_match( '/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, @@ -325,23 +343,25 @@ * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setContent(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $content = $this->getDataContainer()->getContent(); - if (!$content && !$this->getDataContainer()->getLink()) { + if (! $content && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 entry elements MUST contain exactly one ' . 'atom:content element, or as an alternative, at least one link ' . 'with a rel attribute of "alternate" to indicate an alternate ' . 'method to consume the content.'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; return; } } - if (!$content) { + if (! $content) { return; } $element = $dom->createElement('content'); @@ -356,8 +376,10 @@ /** * Load a HTML string and attempt to normalise to XML */ + // @codingStandardsIgnoreStart protected function _loadXhtml($content) { + // @codingStandardsIgnoreEnd if (class_exists('tidy', false)) { $tidy = new \tidy; $config = [ @@ -391,10 +413,12 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { @@ -419,10 +443,12 @@ * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSource(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $source = $this->getDataContainer()->getSource(); - if (!$source) { + if (! $source) { return; } $renderer = new Renderer\Feed\AtomSource($source);