src/Reading/SVGReader.php
private function applyAttributes(SVGNode $node, \SimpleXMLElement $xml,
        array $namespaces)
    {
        foreach ($namespaces as $ns) {
            foreach ($xml->attributes($ns, true) as $key => $value) {
                if ($key === 'style') {
                    continue;
                }
                if (in_array($key, self::$styleAttributes)) {
                    $node->setStyle($key, $value);
                    continue;
                }
                if (!empty($ns) && $ns !== 'svg') {
                    $key = $ns . ':' . $key;
                }
                $node->setAttribute($key, $value);
            }
        }
    }
private function applyAttributes(SVGNode $node, \SimpleXMLElement $xml,
        array $namespaces)
    {
        foreach ($namespaces as $ns) {
            foreach ($xml->attributes($ns, true) as $key => $value) {
                if ($key === 'style') {
                    continue;
                }
                if (in_array($key, self::$styleAttributes)) {
                    $node->setStyle($key, $value);
                    continue;
                }
                if (!empty($ns) && $ns !== 'svg') {
                    $key = $ns . ':' . $key;
                }
                $node->setAttribute($key, $value);
            }
        }
    }
private function applyAttributes ( SVGNode $ node , \ SimpleXMLElement $ xml , array $ namespaces ) { foreach ( $ namespaces as $ ns ) { foreach ( $ xml -> attributes ( $ ns , true ) as $ key => $ value ) { if ( $ key === 'style' ) { continue ; } if ( in_array ( $ key , self :: $ styleAttributes ) ) { $ node -> setStyle ( $ key , $ value ) ; continue ; } if ( ! empty ( $ ns ) && $ ns !== 'svg' ) { $ key = $ ns . ':' . $ key ; } $ node -> setAttribute ( $ key , $ value ) ; } } }
Iterates over all XML attributes and applies them to the given node.

Since styles in SVG can also be expressed with attributes, this method
checks the name of each attribute and, if it matches that of a style,
applies it as a style instead. The actual 'style' attribute is ignored.

@see SVGReader::$styleAttributes The attributes considered styles.

@param SVGNode           $node       The node to apply the attributes to.
@param \SimpleXMLElement $xml        The attribute source.
@param string[]          $namespaces Array of allowed namespace prefixes.

@return void
Iterates over all XML attributes and applies them to the given node .