src/TreeHouse/IoBundle/Scrape/ScraperFactory.php 1 location
|
@@ 204-215 (lines=12) @@
|
| 201 |
|
* |
| 202 |
|
* @return ParserInterface |
| 203 |
|
*/ |
| 204 |
|
protected function createParser(ScraperEntity $scraper) |
| 205 |
|
{ |
| 206 |
|
$options = array_merge( |
| 207 |
|
['scraper' => $scraper], |
| 208 |
|
$scraper->getParserOptions() |
| 209 |
|
); |
| 210 |
|
|
| 211 |
|
$parserType = $this->getParserType($scraper->getParser()); |
| 212 |
|
$builder = new ParserBuilder($this->eventDispatcher); |
| 213 |
|
|
| 214 |
|
return $builder->build($parserType, $options); |
| 215 |
|
} |
| 216 |
|
} |
| 217 |
|
|
src/TreeHouse/IoBundle/Test/Scrape/Parser/ParserTypeTestCase.php 1 location
|
@@ 30-36 (lines=7) @@
|
| 27 |
|
* |
| 28 |
|
* @return ParserInterface |
| 29 |
|
*/ |
| 30 |
|
protected function getParser(Scraper $scraper) |
| 31 |
|
{ |
| 32 |
|
$parserType = $this->get('tree_house.io.scrape.scraper_factory')->getParserType($scraper->getParser()); |
| 33 |
|
$options = array_merge(['scraper' => $scraper], $scraper->getParserOptions()); |
| 34 |
|
|
| 35 |
|
return (new ParserBuilder())->build($parserType, $options); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
/** |
| 39 |
|
* @param string $parser |