private function parseXmlAttributes(\DOMNode $node, array $context = []): array
    {
        if (!$node->hasAttributes()) {
            return [];
        }

        $data = [];
        $typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);

        foreach ($node->attributes as $attr) {
            if (!is_numeric($attr->nodeValue) || !$typeCastAttributes) {
                $data['@'.$attr->nodeName] = $attr->nodeValue;

                continue;
            }

            if (false !== $val = filter_var($attr->nodeValue, FILTER_VALIDATE_INT)) {
                $data['@'.$attr->nodeName] = $val;

                continue;
            }

            $data['@'.$attr->nodeName] = (float) $attr->nodeValue;
        }

        return $data;
    }
private function parseXmlAttributes(\DOMNode $node, array $context = []): array
    {
        if (!$node->hasAttributes()) {
            return [];
        }

        $data = [];
        $typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);

        foreach ($node->attributes as $attr) {
            if (!is_numeric($attr->nodeValue) || !$typeCastAttributes) {
                $data['@'.$attr->nodeName] = $attr->nodeValue;

                continue;
            }

            if (false !== $val = filter_var($attr->nodeValue, FILTER_VALIDATE_INT)) {
                $data['@'.$attr->nodeName] = $val;

                continue;
            }

            $data['@'.$attr->nodeName] = (float) $attr->nodeValue;
        }

        return $data;
    }
private function parseXmlAttributes ( \ DOMNode $ node , array $ context = [ ] ) : array { if ( ! $ node -> hasAttributes ( ) ) { return [ ] ; } $ data = [ ] ; $ typeCastAttributes = ( bool ) ( $ context [ self :: TYPE_CASE_ATTRIBUTES ] ?? $ this -> defaultContext [ self :: TYPE_CASE_ATTRIBUTES ] ) ; foreach ( $ node -> attributes as $ attr ) { if ( ! is_numeric ( $ attr -> nodeValue ) || ! $ typeCastAttributes ) { $ data [ '@' . $ attr -> nodeName ] = $ attr -> nodeValue ; continue ; } if ( false !== $ val = filter_var ( $ attr -> nodeValue , FILTER_VALIDATE_INT ) ) { $ data [ '@' . $ attr -> nodeName ] = $ val ; continue ; } $ data [ '@' . $ attr -> nodeName ] = ( float ) $ attr -> nodeValue ; } return $ data ; }
Parse the input DOMNode attributes into an array.
Parse the input DOMNode attributes into an array .