You are here

public function Entry::setCommentFeedLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Entry.php \Zend\Feed\Writer\Entry::setCommentFeedLink()

Set a link to an XML feed for any comments associated with this entry

Parameters

array $link:

Return value

Entry

Throws

Exception\InvalidArgumentException

1 call to Entry::setCommentFeedLink()
Entry::setCommentFeedLinks in vendor/zendframework/zend-feed/src/Writer/Entry.php
Set a links to an XML feed for any comments associated with this entry. Each link is an array with keys "uri" and "type", where type is one of: "atom", "rss" or "rdf".

File

vendor/zendframework/zend-feed/src/Writer/Entry.php, line 309

Class

Entry

Namespace

Zend\Feed\Writer

Code

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['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'])) {
    $this->data['commentFeedLinks'] = [];
  }
  $this->data['commentFeedLinks'][] = $link;
  return $this;
}