Exemplo n.º 1
0
 /**
  * @param ScraperEntity $scraper
  *
  * @return ParserInterface
  */
 protected function createParser(ScraperEntity $scraper)
 {
     $options = array_merge(['scraper' => $scraper], $scraper->getParserOptions());
     $parserType = $this->getParserType($scraper->getParser());
     $builder = new ParserBuilder($this->eventDispatcher);
     return $builder->build($parserType, $options);
 }
 /**
  * @param Scraper $scraper
  *
  * @return ParserInterface
  */
 protected function getParser(Scraper $scraper)
 {
     $parserType = $this->get('tree_house.io.scrape.scraper_factory')->getParserType($scraper->getParser());
     $options = array_merge(['scraper' => $scraper], $scraper->getParserOptions());
     return (new ParserBuilder())->build($parserType, $options);
 }