Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param \PicoFeed\Config\Config $config Config class instance
  */
 public function __construct(Config $config)
 {
     $this->config = $config;
     Logger::setTimezone($this->config->getTimezone());
 }
Ejemplo n.º 3
0
 /**
  * Constructor.
  *
  * @param \PicoFeed\Config\Config   $config   Config class instance
  */
 public function __construct(Config $config = null)
 {
     $this->config = $config ?: new Config();
     Logger::setTimezone($this->config->getTimezone());
 }