/** * @return FeedChannel **/ public function makeChannel(SimpleXMLElement $xmlFeed) { if (!isset($xmlFeed->channel) || !isset($xmlFeed->channel->title)) { throw new WrongStateException('there are no channels in given rss'); } $feedChannel = FeedChannel::create((string) $xmlFeed->channel->title); if (isset($xmlFeed->channel->link)) { $feedChannel->setLink((string) $xmlFeed->channel->link); } return $feedChannel; }
/** * @return FeedChannel **/ public function makeChannel(SimpleXMLElement $xmlFeed) { $feedChannel = FeedChannel::create((string) $xmlFeed->title); if (isset($xmlFeed->link)) { if (is_array($xmlFeed->link)) { $feedChannel->setLink((string) $xmlFeed->link[0]); } else { $feedChannel->setLink((string) $xmlFeed->link); } } return $feedChannel; }