1 | <?php declare(strict_types=1); |
||
16 | class Explorer |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var \FeedIo\Adapter\ClientInterface; |
||
21 | */ |
||
22 | protected $client; |
||
23 | |||
24 | /** |
||
25 | * @var \Psr\Log\LoggerInterface |
||
26 | */ |
||
27 | protected $logger; |
||
28 | |||
29 | const VALID_TYPES = [ |
||
30 | 'application/atom+xml', |
||
31 | 'application/rss+xml' |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * @param \FeedIo\Adapter\ClientInterface $client |
||
36 | * @param \Psr\Log\LoggerInterface $logger |
||
37 | */ |
||
38 | 1 | public function __construct(ClientInterface $client, LoggerInterface $logger) |
|
43 | |||
44 | /** |
||
45 | * Discover feeds from the webpage's headers |
||
46 | * @param string $url |
||
47 | * @return array |
||
48 | */ |
||
49 | 1 | public function discover(string $url) : array |
|
64 | |||
65 | /** |
||
66 | * Extract feeds Urls from HTML stream |
||
67 | * @param string $html |
||
68 | * @return array |
||
69 | */ |
||
70 | 1 | protected function extractFeeds(string $html) : array |
|
85 | |||
86 | /** |
||
87 | * Tells if the given Element contains a valid Feed Url |
||
88 | * @param DomElement $element |
||
89 | * @return bool |
||
90 | */ |
||
91 | 1 | protected function isFeedLink(\DomElement $element) : bool |
|
96 | } |
||
97 |