Eko\FeedBundle\Feed\FeedManager::get PHP Method

get() public method

Return specified Feed instance if exists.
public get ( string $feedName ) : Eko\FeedBundle\Feed\Feed
$feedName string
return Eko\FeedBundle\Feed\Feed
    public function get($feedName)
    {
        if (!$this->has($feedName)) {
            throw new \InvalidArgumentException(sprintf("Specified feed '%s' is not defined in your configuration.", $feedName));
        }
        if (!isset($this->feeds[$feedName])) {
            $feed = new Feed($this->config['feeds'][$feedName], $this->formatters);
            $feed->setRouter($this->router);
            $this->feeds[$feedName] = $feed;
        }
        return $this->feeds[$feedName];
    }

Usage Example

Example #1
0
 /**
  * Check if the feed data are properly loaded from configuration settings
  */
 public function testGetFeedData()
 {
     $feed = $this->manager->get('article');
     $this->assertEquals('My articles/posts', $feed->get('title'));
     $this->assertEquals('Latests articles', $feed->get('description'));
     $this->assertEquals('http://github.com/eko/FeedBundle', $feed->get('link'));
     $this->assertEquals('utf-8', $feed->get('encoding'));
     $this->assertEquals('Vincent Composieux', $feed->get('author'));
 }
All Usage Examples Of Eko\FeedBundle\Feed\FeedManager::get