Get the styles array for any element

@param $documentElement
@return array
545522
protected function getStylesArray($documentElement)
    {
        $styles = array();

        if ($attributeStyles = $documentElement->getAttribute('_excel-styles')) {
            if (!is_array($attributeStyles)) {
                $decodedJson = json_decode($attributeStyles, true);
                if (null !== $decodedJson) {
                    $attributeStyles = $decodedJson;
                }
            }
        }

        if (is_array($attributeStyles)) {
            $styles = $attributeStyles;
        }

        $styles = $this->sanitizeArray($styles);

        return $styles;
    }
798927
public function render(\DOMDocument $domDocument)
    {
        $this->loadFeatures($this->features);

        $scriptXml  = $domDocument->createElement("script");
        $scriptText = $this->buildScriptText();

        $scriptComment = $domDocument->createComment($scriptText);
        $scriptXml->appendChild($scriptComment);

        return $scriptXml;
    }
885598
protected static function getProperties(DOMElement $element)
	{
		return (isset(self::$htmlElements[$element->nodeName])) ? self::$htmlElements[$element->nodeName] : self::$htmlElements['span'];
	}
917575
public function getNodes($content)
    {
        $items = array();
        $document = $this->createDocumentFromXML($content);
        $nodes = $document->getElementsByTagName('item');
        if ($nodes->length) {
            foreach ($nodes as $node) {
                try {
                    $item = $this->create($node);
                    $items[] = $item;
                } catch (\Exception $e) {
                    throw new RuntimeException($e->getMessage());
                }
            }
        }

        return $items;
    }
1373112
protected function addStyleElementToDocument(\DOMDocument $document, $css)
    {
        $styleElement = $document->createElement('style', $css);
        $styleAttribute = $document->createAttribute('type');
        $styleAttribute->value = 'text/css';
        $styleElement->appendChild($styleAttribute);

        $bodyElement = $this->getBodyElement($document);
        $bodyElement->appendChild($styleElement);
    }
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;
    }
1044796
public static function document($doc)
    {
        $type = 1;
        $valid = self::cpf($doc);
        if ($valid == false) {
            $type = 2;
            $valid = self::cnpj($doc);
        }
        if ($valid == false) {
            return false;
        }
        return ['type' => $type, 'valid' => $valid];
    }
515933
public static function getStyles()
    {
        $styles = [];

        $iterator = new \DirectoryIterator(ForumEnv::get('WEB_ROOT').'themes/');
        foreach ($iterator as $child) {
            if (!$child->isDot() && $child->isDir() &&
                file_exists($child->getPathname().DIRECTORY_SEPARATOR.'style.css')) {
                // If the theme is well formed, add it to the list
                $styles[] = $child->getFileName();
            }
        }

        natcasesort($styles);
        return $styles;
    }
907602
protected function getFieldsetElements(ElementInterface $element, FieldsetInterface $fieldset)
    {
        $elementName = $this->normalizeElementName($element->getName());

        if ($fieldset->has($elementName) && $fieldset->get($elementName) === $element) {
            return array_merge($fieldset->getElements(), $fieldset->getFieldsets());
        }

        if ($fieldset instanceof Element\Collection && (
            ($elements = $this->getFieldsetElements($element, $fieldset->getTargetElement())) ||
            (($template = $fieldset->getTemplateElement()) &&
                ($elements = $this->getFieldsetElements($element, $template)))
        )) {
            return $elements;
        }

        foreach ($fieldset->getFieldsets() as $fieldsetElement) {
            if ($elements = $this->getFieldsetElements($element, $fieldsetElement)) {
                return $elements;
            }
        }

        return [];
    }
1358256
private static function deserializeLicenseTemplates($xmlElement)
    {
        $result = [];

        foreach ($xmlElement->children() as $child) {
            $result[] = self::deserializePlayReadyLicenseTemplate($child);
        }

        return $result;
    }
519884
public function getStyleAttributeArray(): array
    {
        $value = $this->getAttribute('style')['value'];

        if ($value === null) {
            return [];
        }

        $value = explode(';', substr(trim($value), 0, -1));
        $result = [];
        foreach ($value as $attr) {
            $attr = explode(':', $attr);
            $result[$attr[0]] = $attr[1];
        }

        return $result;
    }
940028
private void extractStyles(Document doc) {
        String stylesheet = fetchStyles(doc);

        String trimmedStylesheet = stylesheet.replaceAll("\n", "").replaceAll("/\\*.*?\\*/", "").replaceAll(" +", " ");
        String styleRules = trimmedStylesheet.trim(), delims = "{}";
        StringTokenizer st = new StringTokenizer(styleRules, delims);
        while (st.countTokens() > 1) {
            String selector = st.nextToken(), properties = st.nextToken();
            Elements selectedElements = doc.select(selector);
            for (Element selElem : selectedElements) {
                String oldProperties = selElem.attr(CSS_STYLE);
                selElem.attr(CSS_STYLE,
                        oldProperties.length() > 0 ? concatenateProperties(
                                        oldProperties, properties) : properties);
            }
        }
    }
10410
protected function getInvalidFieldsetElements(ElementInterface $element, FieldsetInterface $fieldset)
    {
        $elementName = $this->normalizeElementName($element->getName());
        $elements = $fieldset->getElements();

        if (isset($elements[$elementName]) && $elements[$elementName] === $element) {
            if ($fieldset->getMessages()) {
                return $elements;
            }

            /* @var $fieldsetElement ElementInterface */
            foreach ($elements as $fieldsetElement) {
                if ($fieldsetElement->getMessages()
                    && ($fieldsetElement->getAttribute('type') === 'hidden'
                        || $fieldsetElement instanceof Element\Captcha)
                ) {
                    return $elements;
                }
            }
        }

        foreach ($fieldset->getFieldsets() as $fieldsetElement) {
            if ($elements = $this->getInvalidFieldsetElements($element, $fieldsetElement)) {
                return $elements;
            }
        }

        return [];
    }
116010
public function getStyles()
	{
		$list	= array();
		$query	= "//style";
		$tags	= $this->getTagsByXPath( $query );
		foreach( $tags as $tag )
			$list[]	= $tag->textContent;
		return $list;
	}
1060944
public static function processElement(array $element) {
    $settings = \Drupal::configFactory()->get('openy_map.settings');
    $element['#attached']['library'][] = 'openy_map/openy_map';
    switch ($settings->get('map_engine')) {
      case 'gmaps':
        $element['#attached']['library'][] = 'openy_map/gmaps';
        $element['#attached']['drupalSettings']['openyMapSettings']['engine'] = 'gmaps';
      break;

      case 'leaflet':
      default:
        $element['#attached']['library'][] = 'openy_map/leaflet';
        $mapSettings = &$element['#attached']['drupalSettings']['openyMapSettings'];
        $mapSettings['engine'] = 'leaflet';
        $mapSettings['default_location'] = urlencode(trim(_openy_map_get_default_location()));
        $mapSettings['search_icon'] = $settings->get('leaflet.search_icon');
        $mapSettings['search_icon_retina'] = $settings->get('leaflet.search_icon_retina');
        $mapSettings['base_layer'] = $settings->get('leaflet.base_layer');
      break;
    }
    $element['#attached']['drupalSettings']['openyMap'] = $element['#element_variables'];
    $tags = $settings->get('default_tags');
    $element['#attached']['drupalSettings']['openyMapSettings']['default_tags'] = array_values(array_filter($tags));
    $element['#cache']['tags'][] = 'config:openy_map.settings';

    return $element;
  }
539487
private function getFormatFor($dateElement)
    {
        if ($this->dateTimeFormat->keyExists($dateElement)) {
            return $this->dateTimeFormat->key($dateElement);
        }

        return self::$formatters->key($dateElement)->first();
    }
753566
public static Element makeStyleElement(Document document) {
    Element style = SVGUtil.svgElement(document, SVGConstants.SVG_STYLE_TAG);
    style.setAttribute(SVGConstants.SVG_TYPE_ATTRIBUTE, SVGConstants.CSS_MIME_TYPE);
    return style;
  }