Ejemplo n.º 1
0
 /**
  * Get a parser instance.
  *
  * @param string $url      Site url
  * @param string $content  Feed content
  * @param string $encoding HTTP encoding
  *
  * @return \AsteFeed\Parser\Parser
  */
 public function getParser($url, $content, $encoding)
 {
     $format = $this->detectFormat($content);
     if (empty($format)) {
         throw new UnsupportedFeedFormatException('Unable to detect feed format');
     }
     $className = '\\AsteFeed\\Parser\\' . $format;
     $parser = new $className($content, $encoding, $url);
     $parser->setHashAlgo($this->config->getParserHashAlgo());
     $parser->setTimezone($this->config->getTimezone());
     $parser->setConfig($this->config);
     return $parser;
 }