1 | <?php |
||
26 | abstract class ParserAbstract |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * @var \Psr\Log\LoggerInterface |
||
31 | */ |
||
32 | protected $logger; |
||
33 | |||
34 | /** |
||
35 | * @var array[FilterInterface] |
||
36 | */ |
||
37 | protected $filters = array(); |
||
38 | |||
39 | /** |
||
40 | * @var StandardAbstract |
||
41 | */ |
||
42 | protected $standard; |
||
43 | |||
44 | /** |
||
45 | * @param StandardAbstract $standard |
||
46 | * @param LoggerInterface $logger |
||
47 | */ |
||
48 | 35 | public function __construct(StandardAbstract $standard, LoggerInterface $logger) |
|
53 | |||
54 | /** |
||
55 | * @param Document $document |
||
56 | * @param FeedInterface $feed |
||
57 | * @return \FeedIo\FeedInterface |
||
58 | */ |
||
59 | abstract function parse(Document $document, FeedInterface $feed); |
||
60 | |||
61 | /** |
||
62 | * @param Document $document |
||
63 | * @param array $mandatoryFields |
||
64 | * @return $this |
||
65 | * @throws MissingFieldsException |
||
66 | */ |
||
67 | abstract public function checkBodyStructure(Document $document, array $mandatoryFields); |
||
68 | |||
69 | /** |
||
70 | * @return StandardAbstract |
||
71 | */ |
||
72 | 21 | public function getStandard() |
|
76 | |||
77 | /** |
||
78 | * @param FeedInterface $feed |
||
79 | * @param NodeInterface $item |
||
80 | * @return $this |
||
81 | */ |
||
82 | 6 | public function addValidItem(FeedInterface $feed, NodeInterface $item) |
|
90 | |||
91 | /** |
||
92 | * @param ItemInterface $item |
||
93 | * @return bool |
||
94 | */ |
||
95 | 8 | public function isValid(ItemInterface $item) |
|
105 | |||
106 | /** |
||
107 | * @param FilterInterface $filter |
||
108 | * @return $this |
||
109 | */ |
||
110 | 4 | public function addFilter(FilterInterface $filter) |
|
116 | |||
117 | /** |
||
118 | * Reset filters |
||
119 | * @return $this |
||
120 | */ |
||
121 | 1 | public function resetFilters() |
|
127 | } |
||
128 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.