1 | <?php |
||
28 | class Parser |
||
29 | { |
||
30 | |||
31 | /** |
||
32 | * @var \Psr\Log\LoggerInterface |
||
33 | */ |
||
34 | protected $logger; |
||
35 | |||
36 | /** |
||
37 | * @var array[FilterInterface] |
||
38 | */ |
||
39 | protected $filters = array(); |
||
40 | |||
41 | /** |
||
42 | * @var StandardAbstract |
||
43 | */ |
||
44 | protected $standard; |
||
45 | |||
46 | /** |
||
47 | * @param StandardAbstract $standard |
||
48 | * @param LoggerInterface $logger |
||
49 | */ |
||
50 | 33 | public function __construct(StandardAbstract $standard, LoggerInterface $logger) |
|
55 | |||
56 | /** |
||
57 | * @return StandardAbstract |
||
58 | */ |
||
59 | 20 | public function getStandard() |
|
63 | |||
64 | /** |
||
65 | * @param $tagName |
||
66 | * @return bool |
||
67 | */ |
||
68 | 7 | public function isItem($tagName) |
|
72 | |||
73 | /** |
||
74 | * @param FilterInterface $filter |
||
75 | * @return $this |
||
76 | */ |
||
77 | 4 | public function addFilter(FilterInterface $filter) |
|
83 | |||
84 | /** |
||
85 | * Reset filters |
||
86 | * @return $this |
||
87 | */ |
||
88 | 1 | public function resetFilters() |
|
94 | |||
95 | /** |
||
96 | * @param DOMDocument $document |
||
97 | * @param FeedInterface $feed |
||
98 | * @return \FeedIo\FeedInterface |
||
99 | * @throws Parser\MissingFieldsException |
||
100 | * @throws Parser\UnsupportedFormatException |
||
101 | */ |
||
102 | 8 | public function parse(DOMDocument $document, FeedInterface $feed) |
|
115 | |||
116 | /** |
||
117 | * @param DOMDocument $document |
||
118 | * @param array $mandatoryFields |
||
119 | * @return $this |
||
120 | * @throws MissingFieldsException |
||
121 | */ |
||
122 | 9 | public function checkBodyStructure(DOMDocument $document, array $mandatoryFields) |
|
142 | |||
143 | /** |
||
144 | * @param NodeInterface $item |
||
145 | * @param \DOMElement $element |
||
146 | * @param RuleSet $ruleSet |
||
147 | * @return NodeInterface |
||
148 | */ |
||
149 | 8 | public function parseNode(NodeInterface $item, \DOMElement $element, RuleSet $ruleSet) |
|
159 | |||
160 | /** |
||
161 | * @param NodeInterface $item |
||
162 | * @param \DOMElement $node |
||
163 | * @param RuleSet $ruleSet |
||
164 | * @return $this |
||
165 | */ |
||
166 | 7 | protected function handleNode(NodeInterface $item, \DOMElement $node, RuleSet $ruleSet) |
|
178 | |||
179 | /** |
||
180 | * @param FeedInterface $feed |
||
181 | * @param NodeInterface $item |
||
182 | * @return $this |
||
183 | */ |
||
184 | 6 | public function addValidItem(FeedInterface $feed, NodeInterface $item) |
|
192 | |||
193 | /** |
||
194 | * @param ItemInterface $item |
||
195 | * @return bool |
||
196 | */ |
||
197 | 8 | public function isValid(ItemInterface $item) |
|
207 | } |
||
208 |