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