/** * @param array $options * * @return Feed * * @throws FeedNotFoundException */ public function getFeedContent(array $options) { $content = new Feed(); $id = array_key_exists('id', $options) ? $options['id'] : null; if ($id === 'not-found') { throw new FeedNotFoundException(); } $content->setPublicId($id); $content->setTitle('thank you for using RssAtomBundle'); $content->setDescription('this is the mock FeedContent'); $content->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/'); $content->setLastModified(new \DateTime()); $item = new Item(); $item->setPublicId('1'); $item->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/somelink'); $item->setTitle('This is an item'); $item->setDescription('this stream was generated using the MockProvider class'); $item->setLastModified(new \DateTime()); $content->add($item); return $content; }
/** * @param BSONDocument $document * @param \FeedIo\Feed $xmlFeed * @return \FeedIo\Feed */ protected function addItems(BSONDocument $document, \FeedIo\Feed $xmlFeed) { foreach ($document->feed->items as $dbItem) { $xmlItem = new Item(); $xmlItem->setTitle($dbItem->title)->setLink($dbItem->link)->setDescription($dbItem->description)->setLastModified(new \DateTime($dbItem->lastModified)); $xmlFeed->add($xmlItem); } return $xmlFeed; }