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 | 34 | public function __construct(StandardAbstract $standard, LoggerInterface $logger) |
|
55 | |||
56 | /** |
||
57 | * @return StandardAbstract |
||
58 | */ |
||
59 | 21 | 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 | 10 | public function addFilter(FilterInterface $filter) |
|
83 | |||
84 | /** |
||
85 | * @param DOMDocument $document |
||
86 | * @param FeedInterface $feed |
||
87 | 8 | * @return \FeedIo\FeedInterface |
|
88 | * @throws Parser\MissingFieldsException |
||
89 | 8 | * @throws Parser\UnsupportedFormatException |
|
90 | 1 | */ |
|
91 | public function parse(DOMDocument $document, FeedInterface $feed) |
||
104 | |||
105 | 8 | /** |
|
106 | 1 | * @param DOMDocument $document |
|
107 | * @param array $mandatoryFields |
||
108 | * @return $this |
||
109 | 7 | * @throws MissingFieldsException |
|
110 | 7 | */ |
|
111 | 7 | public function checkBodyStructure(DOMDocument $document, array $mandatoryFields) |
|
131 | 2 | ||
132 | 2 | /** |
|
133 | * @param NodeInterface $item |
||
134 | * @param \DOMElement $element |
||
135 | * @param RuleSet $ruleSet |
||
136 | 9 | * @return NodeInterface |
|
137 | 1 | */ |
|
138 | 1 | public function parseNode(NodeInterface $item, \DOMElement $element, RuleSet $ruleSet) |
|
148 | |||
149 | /** |
||
150 | * @param NodeInterface $item |
||
151 | 8 | * @param \DOMElement $node |
|
152 | * @param RuleSet $ruleSet |
||
153 | 8 | * @return $this |
|
154 | 7 | */ |
|
155 | 7 | protected function handleNode(NodeInterface $item, \DOMElement $node, RuleSet $ruleSet) |
|
167 | |||
168 | 7 | /** |
|
169 | * @param FeedInterface $feed |
||
170 | 7 | * @param NodeInterface $item |
|
171 | 6 | * @return $this |
|
172 | 6 | */ |
|
173 | public function addValidItem(FeedInterface $feed, NodeInterface $item) |
||
181 | |||
182 | /** |
||
183 | * @param ItemInterface $item |
||
184 | * @return bool |
||
185 | */ |
||
186 | 6 | public function isValid(ItemInterface $item) |
|
196 | } |
||
197 |