You are here

public function AbstractFeed::setFeedLink in Zircon Profile 8.0

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

Set a link to an XML feed for any feed type/version

Parameters

string $link:

string $type:

Return value

AbstractFeed

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php, line 375

Class

AbstractFeed

Namespace

Zend\Feed\Writer

Code

public function setFeedLink($link, $type) {
  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 (!in_array(strtolower($type), [
    'rss',
    'rdf',
    'atom',
  ])) {
    throw new Exception\InvalidArgumentException('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom');
  }
  $this->data['feedLinks'][strtolower($type)] = $link;
  return $this;
}