1 | <?php |
||
15 | abstract class RuleAbstract |
||
16 | { |
||
17 | const NODE_NAME = 'node'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $nodeName; |
||
23 | |||
24 | /** |
||
25 | * @param string $nodeName |
||
26 | */ |
||
27 | 90 | public function __construct($nodeName = null) |
|
31 | |||
32 | /** |
||
33 | * @return string |
||
34 | */ |
||
35 | 52 | public function getNodeName() |
|
39 | |||
40 | /** |
||
41 | * @param \DOMElement $element |
||
42 | * @param string $name |
||
43 | * @return string|null |
||
44 | */ |
||
45 | 8 | public function getAttributeValue(\DOMElement $element, $name) |
|
53 | |||
54 | /** |
||
55 | * @param \DOMElement $element |
||
56 | * @param string $name |
||
57 | * @return string|null |
||
58 | */ |
||
59 | 3 | public function getChildValue(\DOMElement $element, $name) |
|
68 | |||
69 | /** |
||
70 | * Sets the accurate $item property according to the DomElement content |
||
71 | * |
||
72 | * @param NodeInterface $node |
||
73 | * @param \DOMElement $element |
||
74 | * @return mixed |
||
75 | */ |
||
76 | abstract public function setProperty(NodeInterface $node, \DOMElement $element); |
||
77 | |||
78 | /** |
||
79 | * creates the accurate DomElement content according to the $item's property |
||
80 | * |
||
81 | * @param \DomDocument $document |
||
82 | * @param NodeInterface $node |
||
83 | * @return \DomElement |
||
84 | */ |
||
85 | abstract public function createElement(\DomDocument $document, NodeInterface $node); |
||
86 | } |
||
87 |