|
4 | 4 | namespace Embed\Adapters\ImageShack; |
5 | 5 |
|
6 | 6 | use Embed\Extractor as Base; |
7 | | -use Embed\Http\Crawler; |
8 | | -use Psr\Http\Message\RequestInterface; |
9 | | -use Psr\Http\Message\ResponseInterface; |
10 | | -use Psr\Http\Message\UriInterface; |
11 | 7 |
|
12 | 8 | class Extractor extends Base |
13 | 9 | { |
14 | 10 | private Api $api; |
15 | 11 |
|
16 | | - public function __construct(UriInterface $uri, RequestInterface $request, ResponseInterface $response, Crawler $crawler) |
| 12 | + public function getApi(): Api |
17 | 13 | { |
18 | | - parent::__construct($uri, $request, $response, $crawler); |
19 | | - |
20 | | - $this->api = new Api($this); |
21 | | - |
22 | | - $this->authorName = new Detectors\AuthorName($this); |
23 | | - $this->authorUrl = new Detectors\AuthorUrl($this); |
24 | | - $this->description = new Detectors\Description($this); |
25 | | - $this->image = new Detectors\Image($this); |
26 | | - $this->providerName = new Detectors\ProviderName($this); |
27 | | - $this->publishedTime = new Detectors\PublishedTime($this); |
28 | | - $this->title = new Detectors\Title($this); |
| 14 | + return $this->api; |
29 | 15 | } |
30 | 16 |
|
31 | | - public function getApi(): Api |
| 17 | + public function createCustomDetectors(): array |
32 | 18 | { |
33 | | - return $this->api; |
| 19 | + $this->api = new Api($this); |
| 20 | + |
| 21 | + return [ |
| 22 | + 'authorName' => new Detectors\AuthorName($this), |
| 23 | + 'authorUrl' => new Detectors\AuthorUrl($this), |
| 24 | + 'description' => new Detectors\Description($this), |
| 25 | + 'image' => new Detectors\Image($this), |
| 26 | + 'providerName' => new Detectors\ProviderName($this), |
| 27 | + 'publishedTime' => new Detectors\PublishedTime($this), |
| 28 | + 'title' => new Detectors\Title($this), |
| 29 | + ]; |
34 | 30 | } |
35 | 31 | } |
0 commit comments