26 private $converterUtils;
34 $this->converter = $converter;
35 $this->converterUtils = $converterUtils;
43 if ($node->nodeType !== XML_ELEMENT_NODE) {
47 return $this->toArray($node);
56 private function toArray(\DOMNode $node)
58 if ($node->nodeType == XML_ELEMENT_NODE && $node->getAttribute(
Dom::TYPE_ATTRIBUTE) ==
'url') {
59 $urlResult = $this->converter->convert($node, [
'type' =>
'url']);
60 return $urlResult ?: [];
65 if ($this->hasChildNodes($node)) {
69 if (trim($node->nodeValue) !=
'') {
70 $result[
'value'] = trim($node->nodeValue);
73 if ($node->hasAttributes() && $node->nodeType === XML_ELEMENT_NODE) {
85 private function hasChildNodes(\DOMNode $node)
87 if ($node->hasChildNodes()) {
88 foreach ($node->childNodes as $childNode) {
89 if ($childNode->nodeType == XML_ELEMENT_NODE) {
103 private function processAttributes(\DOMNode $node)
122 private function processChildNodes(\DOMNode $node)
126 foreach ($node->childNodes as $childNode) {
127 if ($childNode->nodeType === XML_ELEMENT_NODE) {
128 $result[
'item'][$this->converterUtils->getComponentName($childNode)] = $this->toArray($childNode);
convert(\DOMNode $node, array $data=[])
__construct(ConverterInterface $converter, ConverterUtils $converterUtils)