1 | <?php |
||
29 | class Reader |
||
30 | { |
||
31 | /** |
||
32 | * @var \FeedIo\Adapter\ClientInterface; |
||
33 | */ |
||
34 | protected $client; |
||
35 | |||
36 | /** |
||
37 | * @var \Psr\Log\LoggerInterface |
||
38 | */ |
||
39 | protected $logger; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $parsers = array(); |
||
45 | |||
46 | /** |
||
47 | * @param ClientInterface $client |
||
48 | * @param LoggerInterface $logger |
||
49 | */ |
||
50 | 7 | public function __construct(ClientInterface $client, LoggerInterface $logger) |
|
55 | |||
56 | /** |
||
57 | * @param Parser $parser |
||
58 | * @return $this |
||
59 | */ |
||
60 | 7 | public function addParser(Parser $parser) |
|
67 | |||
68 | /** |
||
69 | * adds a filter to every parsers |
||
70 | * |
||
71 | * @param \FeedIo\FilterInterface $filter |
||
72 | * @return $this |
||
73 | */ |
||
74 | 1 | public function addFilter(FilterInterface $filter) |
|
82 | |||
83 | /** |
||
84 | * Reset filters on every parsers |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function resetFilters() |
||
95 | |||
96 | /** |
||
97 | * @param string $body |
||
98 | * @return \DOMDocument |
||
99 | */ |
||
100 | public function loadDocument($body) |
||
118 | |||
119 | /** |
||
120 | * @param $url |
||
121 | * @param FeedInterface $feed |
||
122 | * @param \DateTime $modifiedSince |
||
123 | * @return \FeedIo\Reader\Result |
||
124 | * @throws ReadErrorException |
||
125 | */ |
||
126 | public function read($url, FeedInterface $feed, \DateTime $modifiedSince = null) |
||
149 | |||
150 | /** |
||
151 | * @param \DOMDocument $document |
||
152 | * @param FeedInterface $feed |
||
153 | * @return FeedInterface |
||
154 | * @throws Parser\UnsupportedFormatException |
||
155 | * @throws Reader\NoAccurateParserException |
||
156 | */ |
||
157 | public function parseDocument(\DOMDocument $document, FeedInterface $feed) |
||
164 | |||
165 | /** |
||
166 | * @param \DOMDocument $document |
||
167 | * @return ParserAbstract |
||
168 | * @throws Reader\NoAccurateParserException |
||
169 | */ |
||
170 | public function getAccurateParser(\DOMDocument $document) |
||
182 | } |
||
183 |