/** * Factory method to create a SimplePie instance * * If a file URL is set as feedUrl on the channel, the raw data will be set * on SimplePie to enable functional testing. * * @param \Planetflow3\Domain\Model\Channel $channel * @return \SimplePie */ protected function createSimplePie(Channel $channel) { $simplePie = new \SimplePie(); if (strpos($channel->getFeedUrl(), 'file://') === 0) { $simplePie->set_raw_data(file_get_contents($channel->getFeedUrl())); } else { $simplePie->set_feed_url($channel->getFeedUrl()); } $simplePie->enable_cache(FALSE); $simplePie->init(); return $simplePie; }
/** * Check if this item matches the channel settings * * @param \Planetflow3\Domain\Model\Channel $channel * @return boolean */ public function matchesChannel(\Planetflow3\Domain\Model\Channel $channel) { return $this->matchesFilter($channel->getFilter()) && $this->matchesCategories($channel->getFetchedCategories()); }