| @@ 69-83 (lines=15) @@ | ||
| 66 | * |
|
| 67 | * @return CrawlerInterface |
|
| 68 | */ |
|
| 69 | public function getCrawler($alias) |
|
| 70 | { |
|
| 71 | if (!array_key_exists($alias, $this->crawlers)) { |
|
| 72 | throw new \OutOfBoundsException( |
|
| 73 | sprintf( |
|
| 74 | 'Crawler "%s" is not registered. You can add it by creating a service which implements %s, ' . |
|
| 75 | 'and tag it with tree_house.io.scrape.crawler', |
|
| 76 | $alias, |
|
| 77 | CrawlerInterface::class |
|
| 78 | ) |
|
| 79 | ); |
|
| 80 | } |
|
| 81 | ||
| 82 | return $this->crawlers[$alias]; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @return CrawlerInterface[] |
|
| @@ 106-120 (lines=15) @@ | ||
| 103 | * |
|
| 104 | * @return ParserTypeInterface |
|
| 105 | */ |
|
| 106 | public function getParserType($alias) |
|
| 107 | { |
|
| 108 | if (!array_key_exists($alias, $this->parserTypes)) { |
|
| 109 | throw new \OutOfBoundsException( |
|
| 110 | sprintf( |
|
| 111 | 'Parser type "%s" is not registered. You can add it by creating a service which implements %s, ' . |
|
| 112 | 'and tag it with tree_house.io.scrape.parser_type', |
|
| 113 | $alias, |
|
| 114 | ParserTypeInterface::class |
|
| 115 | ) |
|
| 116 | ); |
|
| 117 | } |
|
| 118 | ||
| 119 | return $this->parserTypes[$alias]; |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @return ParserTypeInterface[] |
|
| @@ 143-157 (lines=15) @@ | ||
| 140 | * |
|
| 141 | * @return HandlerInterface |
|
| 142 | */ |
|
| 143 | public function getHandler($alias) |
|
| 144 | { |
|
| 145 | if (!array_key_exists($alias, $this->handlers)) { |
|
| 146 | throw new \OutOfBoundsException( |
|
| 147 | sprintf( |
|
| 148 | 'Handler "%s" is not registered. You can add it by creating a service which implements %s, ' . |
|
| 149 | 'and tag it with tree_house.io.scrape.handler', |
|
| 150 | $alias, |
|
| 151 | HandlerInterface::class |
|
| 152 | ) |
|
| 153 | ); |
|
| 154 | } |
|
| 155 | ||
| 156 | return $this->handlers[$alias]; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * @return HandlerInterface[] |
|