You are here

public function AbstractFeed::setImage in Zircon Profile 8

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

Set a feed image (URI at minimum). Parameter is a single array with the required key 'uri'. When rendering as RSS, the required keys are 'uri', 'title' and 'link'. RSS also specifies three optional parameters 'width', 'height' and 'description'. Only 'uri' is required and used for Atom rendering.

Parameters

array $data:

Return value

AbstractFeed

Throws

Exception\InvalidArgumentException

File

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

Class

AbstractFeed

Namespace

Zend\Feed\Writer

Code

public function setImage(array $data) {
  if (empty($data['uri']) || !is_string($data['uri']) || !Uri::factory($data['uri'])
    ->isValid()) {
    throw new Exception\InvalidArgumentException('Invalid parameter: parameter \'uri\'' . ' must be a non-empty string and valid URI/IRI');
  }
  $this->data['image'] = $data;
  return $this;
}