1 | <?php declare(strict_types=1); |
||
20 | abstract class XmlAbstract extends StandardAbstract |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Name of the node containing all the feed's items |
||
25 | */ |
||
26 | const ITEM_NODE = 'item'; |
||
27 | |||
28 | /** |
||
29 | * This is for XML Standards |
||
30 | */ |
||
31 | const SYNTAX_FORMAT = 'Xml'; |
||
32 | |||
33 | /** |
||
34 | * RuleSet used to parse the feed's main node |
||
35 | * @var \FeedIo\RuleSet |
||
36 | */ |
||
37 | protected $feedRuleSet; |
||
38 | |||
39 | /** |
||
40 | * @var \FeedIo\RuleSet |
||
41 | */ |
||
42 | protected $itemRuleSet; |
||
43 | |||
44 | /** |
||
45 | * Formats the document according to the standard's specification |
||
46 | * @param \DOMDocument $document |
||
47 | * @return \DOMDocument |
||
48 | */ |
||
49 | abstract public function format(\DOMDocument $document) : \DOMDocument; |
||
50 | |||
51 | /** |
||
52 | * @param \DOMDocument $document |
||
53 | * @return \DomElement |
||
54 | */ |
||
55 | abstract public function getMainElement(\DOMDocument $document) : \DOMElement; |
||
56 | |||
57 | /** |
||
58 | * Builds and returns a rule set to parse the root node |
||
59 | * @return \FeedIo\RuleSet |
||
60 | */ |
||
61 | abstract public function buildFeedRuleSet() : RuleSet; |
||
62 | |||
63 | /** |
||
64 | * Builds and returns a rule set to parse an item |
||
65 | * @return \FeedIo\RuleSet |
||
66 | */ |
||
67 | abstract public function buildItemRuleSet() : RuleSet; |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | 13 | */ |
|
72 | public function getItemNodeName() : string |
||
76 | |||
77 | /** |
||
78 | * @return FormatterInterface |
||
79 | */ |
||
80 | public function getFormatter() : FormatterInterface |
||
81 | { |
||
82 | return new XmlFormatter($this); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Returns the RuleSet used to parse the feed's main node |
||
87 | * @return \FeedIo\RuleSet |
||
88 | 14 | */ |
|
89 | 1 | public function getFeedRuleSet() : RuleSet |
|
97 | |||
98 | /** |
||
99 | * @return \FeedIo\RuleSet |
||
100 | 12 | */ |
|
101 | public function getItemRuleSet() : RuleSet |
||
109 | |||
110 | /** |
||
111 | * @param string $tagName |
||
112 | * @return ModifiedSince |
||
113 | 16 | */ |
|
114 | public function getModifiedSinceRule(string $tagName) : ModifiedSince |
||
122 | |||
123 | /** |
||
124 | * @return RuleSet |
||
125 | 16 | */ |
|
126 | protected function buildBaseRuleSet() : RuleSet |
||
133 | } |
||
134 |