@param \DOMElement $node

@return array
510611
private function transformType(\DOMElement $node): array
    {
        $data = [];

        $childNodes = [];
        foreach ($node->childNodes as $childNode) {
            if ($childNode instanceof \DOMElement) {
                $childNodes[] = $childNode;
            }
        }

        foreach ($childNodes as $childNode) {
            if (0 === $childNode->childNodes->length) {
                $data[$this->getKey($childNode)] = null;

                continue;
            }

            if (1 === $childNode->childNodes->length) {
                $data[$this->getKey($childNode)] = $this->getValue($childNode);

                continue;
            }

            if ('object' === $childNode->nodeName
                && $childNode->hasAttribute('type')
                && !$childNode->hasAttribute('key')
            ) {
                return $this->transformType($childNode);
            }

            $data[$this->getKey($childNode)] = $this->transformType($childNode);
        }

        if ('object' === $node->nodeName && $node->hasAttribute('type')) {
            $data['_type'] = $node->getAttribute('type');
        }

        return $data;
    }
625173
protected function getItemReferenceElements(\DOMElement $element)
    {
        $itemrefElements = [];
        $itemrefs = trim($element->getAttribute('itemref'));
        $itemrefs = strlen($itemrefs) ? preg_split('/\s+/', $itemrefs) : [];
        foreach ($itemrefs as $itemref) {
            $itemrefElement = $element->ownerDocument->getElementById($itemref);
            if ($itemrefElement instanceof \DOMElement) {
                $itemrefElements[] = $itemrefElement;
            }
        }
        return $itemrefElements;
    }
751774
private function getAttrAsArray(\DOMElement $element)
    {
        $return = [];
        for ($i = 0; $i < $element->attributes->length; ++$i) {
            $return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
        }

        return $return;
    }
884579
private function getChildren(\DOMNode $node, $name)
    {
        $children = array();
        foreach ($node->childNodes as $child) {
            if ($child instanceof \DOMElement && $child->localName === $name) {
                $children[] = $child;
            }
        }

        return $children;
    }
1110500
protected function getAttributes(DOMElement $element)
	{
		$attributes = array();
		foreach ($element->attributes as $attribute)
		{
			$key = $attribute->namespaceURI . '#' . $attribute->nodeName;
			$attributes[$key] = $attribute->nodeValue;
		}

		return $attributes;
	}
286602
protected function getNodeValueByTagName(DOMElement $node, $tagName)
    {
        $results = $node->getElementsByTagName($tagName);
        for ($i = 0; $i < $results->length; $i++) {
            $result = $results->item($i);
            if (!$result->nodeValue) {
                continue;
            }

            return $result->nodeValue;
        }

        return false;
    }
564920
public static function getText(DOMElement $node)
    {
        $s = '';
        for ($i = 0; $i < $node->childNodes->length; $i++) {
            $child = $node->childNodes->item($i);

            switch ($child->nodeType) {
                case XML_CDATA_SECTION_NODE:
                case XML_TEXT_NODE: {
                    $s .= $child->nodeValue;
                }
            }
        }

        return $s;
    }
321064
protected function restoreItemFromXml(DOMElement $node)
    {
        $item = array('attributes' => array());

        if ($node->hasAttributes()) {
            foreach ($node->attributes as $attr) {
                switch ($attr->name) {
                    case 'action':
                        $item['action'] = $attr->value;
                        break;
                    default:
                        $item['attributes'][$attr->name] = $attr->value;
                }
            }
        }

        foreach ($node->childNodes as $node) {
            if ($node->nodeType !== XML_ELEMENT_NODE) {
                continue;
            }

            switch ($node->nodeName) {
                case 'object_id':
                    $item['contentId'] = $node->nodeValue;
                    break;
                case 'node_id':
                    $item['locationId'] = $node->nodeValue;
                    break;
                case 'priority':
                    $item[$node->nodeName] = $node->nodeValue;
                    break;
                case 'ts_publication':
                    $item['publicationDate'] = $node->nodeValue;
                    break;
                case 'ts_visible':
                    $item['visibilityDate'] = $node->nodeValue;
                    break;
                case 'ts_hidden':
                    $item['hiddenDate'] = $node->nodeValue;
                    break;
                case 'rotation_until':
                    $item['rotationUntilDate'] = $node->nodeValue;
                    break;
                case 'moved_to':
                    $item['movedTo'] = $node->nodeValue;
                    break;
            }
        }

        return new Parts\Item($item);
    }
1201408
private function getImageCandidates(Element $node): array {
        $images = $node->find('img');
        $filteredImages = $this->filterBadNames($images);
        $goodImages = $this->findImagesThatPassByteSizeTest($filteredImages);

        return $goodImages;
    }
1199842
private function getRowValues(\DOMElement $item, int $themeId): array
    {
        $fields = $item->childNodes;
        $values = [];

        for ($index = 0; $index < $fields->length; $index++) {
            $value = $fields->item($index)->nodeValue;
            $name  = $fields->item($index)->getAttribute('name');

            switch ($name) {
                case 'id':
                    break;

                case 'pid':
                    $values[$name] = $themeId;

                    break;

                default:
                    if ($value === 'NULL') {
                        $value = null;
                    }

                    $values[$name] = $value;
            }
        }

        return $values;
    }
148415
protected function getBlockList(\DOMElement $element) {
    $lines = array();
    $prefix = $element->nodeName == 'ol' ? ' 1. ' : ' - ';
    // Markdown does not support definition lists, convert to ul.
    if ($element->nodeName == 'dl') {
      $newline = TRUE;
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'dt':
            if ($newline) {
              $lines[] = $prefix . $this->getBlock($child);
            }
            else {
              $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            }
            $newline = FALSE;
            break;

          case 'dd':
            $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            $newline = TRUE;
            break;

        }
      }
    }
    else {
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'li':
            $lines[] = $prefix . $this->getBlock($child);
            break;

        }
      }
    }
    return implode("\n", $lines);
  }
1300824
public function getNodeAttributes(Node $node)
    {
        // Extract the properties of the node
        $attributes = $node->getProperties();

        // Add the node id to the attributes since \Everyman\Neo4j\Node
        // does not consider it to be a property, it is treated differently
        // and available through the getId() method.
        $attributes['id'] = $node->getId();

        return $attributes;
    }
996428
private function buildOptionValue(\DOMElement $node): array
    {
        $option = array();

        $defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on';
        $defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : $defaultDefaultValue;
        $option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue;
        $option['disabled'] = $node->hasAttribute('disabled');

        return $option;
    }
988334
public static function getChildElements(DOMElement $parent, $childName)
    {
        $listElements = $parent->getElementsByTagName($childName);
        if ($listElements->length > 0) {
            $list = [];

            for ($i = 0; $i < $listElements->length; $i++) {
                $currentItem = $listElements->item($i);

                if (!$parent->isSameNode($currentItem->parentNode)) {
                    continue;
                }

                $list[] = $currentItem;
            }

            return $list;
        }

        return [];
    }
230028
private function getKey(\DOMElement $node)
    {
        if ($node->hasAttribute('key')) {
            return (int) $node->getAttribute('key');
        }

        $name = $node->nodeName;
        if (0 === strpos($name, 'meta-')) {
            $name = '_'.substr($name, 5);
        }

        return $name;
    }
983158
protected function getObjectParams(DOMElement $object)
	{
		$params      = [];
		$settingName = strtolower($this->settingName);
		foreach ($object->getElementsByTagName('param') as $param)
		{
			$paramName = strtolower($param->getAttribute('name'));
			if ($paramName === $settingName && $param->parentNode->isSameNode($object))
			{
				$params[] = $param;
			}
		}

		return $params;
	}
61275
protected function getNextSiblingOfTypeDOMElement(\DOMNode $node)
    {
        do {
            $node = $node->nextSibling;
        } while (!($node === null || $node instanceof \DOMElement));

        return $node;
    }