public function __construct($options, $limit = 0)
{
parent::__construct($options, $limit);
// Create the SimpleXMLElement
if (null === $this->obj) {
if (!($this->obj = simplexml_load_string($this->source, 'SimpleXMLElement', LIBXML_NOWARNING))) {
throw new Exception('That feed URL cannot be read at this time. Please try again later.');
}
}
// Check for the date
if (isset($this->obj->channel->lastBuildDate)) {
$date = (string) $this->obj->channel->lastBuildDate;
} else {
if (isset($this->obj->channel->pubDate)) {
$date = (string) $this->obj->channel->pubDate;
} else {
$date = null;
}
}
// Get the main header info of the feed
$feed = array();
$feed['title'] = isset($this->obj->channel->title) ? (string) $this->obj->channel->title : null;
$feed['url'] = isset($this->obj->channel->link) ? (string) (string) $this->obj->channel->link : null;
$feed['description'] = isset($this->obj->channel->description) ? (string) $this->obj->channel->description : null;
$feed['date'] = $date;
$feed['generator'] = isset($this->obj->channel->generator) ? (string) $this->obj->channel->generator : null;
$feed['author'] = isset($this->obj->channel->managingEditor) ? (string) $this->obj->channel->managingEditor : null;
$feed['items'] = array();
$this->feed = new \ArrayObject($feed, \ArrayObject::ARRAY_AS_PROPS);
}