You are here

public function AbstractFeed::setId 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::setId()

Set the feed ID - URI or URN (via PCRE pattern) supported

Parameters

string $id:

Return value

AbstractFeed

Throws

Exception\InvalidArgumentException

File

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

Class

AbstractFeed

Namespace

Zend\Feed\Writer

Code

public function setId($id) {
  if ((empty($id) || !is_string($id) || !Uri::factory($id)
    ->isValid()) && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\\-]{1,31}:([a-zA-Z0-9\\(\\)\\+\\,\\.\\:\\=\\@\\;\$\\_\\!\\*\\-]|%[0-9a-fA-F]{2})*#", $id) && !$this
    ->_validateTagUri($id)) {
    throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI');
  }
  $this->data['id'] = $id;
  return $this;
}