You are here

public function Feed::export in Zircon Profile 8.0

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

Attempt to build and return the feed resulting from the data set

Parameters

string $type The feed type "rss" or "atom" to export as:

bool $ignoreExceptions:

Return value

string

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/Writer/Feed.php, line 224

Class

Feed

Namespace

Zend\Feed\Writer

Code

public function export($type, $ignoreExceptions = false) {
  $this
    ->setType(strtolower($type));
  $type = ucfirst($this
    ->getType());
  if ($type !== 'Rss' && $type !== 'Atom') {
    throw new Exception\InvalidArgumentException('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".');
  }
  $renderClass = 'Zend\\Feed\\Writer\\Renderer\\Feed\\' . $type;
  $renderer = new $renderClass($this);
  if ($ignoreExceptions) {
    $renderer
      ->ignoreExceptions();
  }
  return $renderer
    ->render()
    ->saveXml();
}