1 | <?php |
||
11 | abstract class BaseParser implements CodepointAwareParser |
||
12 | { |
||
13 | const ATTRIBUTE_VALUE_YES = 'Y'; |
||
14 | |||
15 | /** |
||
16 | * @var \DOMElement |
||
17 | */ |
||
18 | protected $element; |
||
19 | |||
20 | /** |
||
21 | * @var Codepoint |
||
22 | */ |
||
23 | protected $codepoint; |
||
24 | |||
25 | /** |
||
26 | * @return mixed |
||
27 | */ |
||
28 | abstract protected function parse(); |
||
29 | |||
30 | /** |
||
31 | * @param \DOMElement $element |
||
32 | * @param Codepoint $codepoint |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function parseElement(\DOMElement $element, Codepoint $codepoint) |
||
42 | |||
43 | /** |
||
44 | * @param string $name |
||
45 | * @return string|null |
||
46 | */ |
||
47 | protected function getOptionalAttribute($name) |
||
57 | |||
58 | /** |
||
59 | * @param string $name |
||
60 | * @return string |
||
61 | * @throws UnexpectedValueException |
||
62 | */ |
||
63 | protected function getAttribute($name) |
||
73 | |||
74 | /** |
||
75 | * @param string $name |
||
76 | * @return bool |
||
77 | */ |
||
78 | protected function getBoolAttribute($name) |
||
82 | |||
83 | /** |
||
84 | * @param string $value |
||
85 | * @param Codepoint $codepoint |
||
86 | * @return string |
||
87 | */ |
||
88 | protected function parsePlaceholders($value, Codepoint $codepoint) |
||
98 | |||
99 | /** |
||
100 | * @param string $list |
||
101 | * @return Codepoint[] |
||
102 | */ |
||
103 | protected function parseCodepointList($list) |
||
111 | } |