| 1 | <?php declare(strict_types=1); |
||
| 13 | class Description extends RuleAbstract |
||
| 14 | { |
||
| 15 | const NODE_NAME = 'description'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param NodeInterface $node |
||
| 19 | * @param \DOMElement $element |
||
| 20 | */ |
||
| 21 | 9 | public function setProperty(NodeInterface $node, \DOMElement $element) : void |
|
| 22 | { |
||
| 23 | 9 | $string = ''; |
|
| 24 | 9 | if ($element->firstChild && $element->firstChild->nodeType == XML_CDATA_SECTION_NODE) { |
|
| 25 | 1 | $string = $element->firstChild->textContent; |
|
| 26 | } else { |
||
| 27 | 9 | foreach ($element->childNodes as $childNode) { |
|
| 28 | 9 | $string .= $element->ownerDocument->saveXML($childNode); |
|
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | 9 | $node->setDescription(htmlspecialchars_decode($string)); |
|
| 33 | 9 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | 3 | protected function hasValue(NodeInterface $node) : bool |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @inheritDoc |
||
| 45 | */ |
||
| 46 | 3 | protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node) : void |
|
| 52 | } |
||
| 53 |