예제 #1
0
 /**
  * Get xml from feed data
  *
  * @codeCoverageIgnore due to static method call (\Zend_Feed::importArray)
  *
  * @param FeedInterface $feed
  * @return string
  */
 public function toXml(FeedInterface $feed)
 {
     $data = ['title' => $feed->getTitle(), 'link' => $feed->getLink(), 'charset' => 'UTF-8', 'description' => $feed->getDescription()];
     $rssFeedFromArray = $this->zendFeed->importArray($data, 'rss');
     $xml = $rssFeedFromArray->saveXML();
     return $xml;
 }
예제 #2
0
 /**
  * @param FeedInterface $feed
  * @param Filter $filter
  * @return bool
  */
 private function isFeedMatchesFilter(FeedInterface $feed, Filter $filter)
 {
     switch (strtolower($filter->getField())) {
         case 'id':
             $isMatches = $filter->getValue() === $feed->getId();
             break;
         case 'title':
             $isMatches = strpos($feed->getTitle(), $filter->getValue()) !== false;
             break;
         case 'description':
             $isMatches = strpos($feed->getDescription(), $filter->getValue()) !== false;
             break;
         default:
             $isMatches = false;
             break;
     }
     return $isMatches;
 }