src/Reading/SVGReader.php
private function parseNode(\SimpleXMLElement $xml, array $namespaces)
    {
        $type = $xml->getName();

        if (isset(self::$nodeTypes[$type])) {
            $call = array(self::$nodeTypes[$type], 'constructFromAttributes');
            $node = call_user_func($call, $xml);
        } else {
            $node = new SVGGenericNodeType($type);
        }

        $this->applyAttributes($node, $xml, $namespaces);
        $this->applyStyles($node, $xml);
        $node->setValue($xml);

        if ($node instanceof SVGNodeContainer) {
            $this->addChildren($node, $xml, $namespaces);
        }

        return $node;
    }
private function parseNode(\SimpleXMLElement $xml, array $namespaces)
    {
        $type = $xml->getName();

        if (isset(self::$nodeTypes[$type])) {
            $call = array(self::$nodeTypes[$type], 'constructFromAttributes');
            $node = call_user_func($call, $xml);
        } else {
            $node = new SVGGenericNodeType($type);
        }

        $this->applyAttributes($node, $xml, $namespaces);
        $this->applyStyles($node, $xml);
        $node->setValue($xml);

        if ($node instanceof SVGNodeContainer) {
            $this->addChildren($node, $xml, $namespaces);
        }

        return $node;
    }
private function parseNode ( \ SimpleXMLElement $ xml , array $ namespaces ) { $ type = $ xml -> getName ( ) ; if ( isset ( self :: $ nodeTypes [ $ type ] ) ) { $ call = array ( self :: $ nodeTypes [ $ type ] , 'constructFromAttributes' ) ; $ node = call_user_func ( $ call , $ xml ) ; } else { $ node = new SVGGenericNodeType ( $ type ) ; } $ this -> applyAttributes ( $ node , $ xml , $ namespaces ) ; $ this -> applyStyles ( $ node , $ xml ) ; $ node -> setValue ( $ xml ) ; if ( $ node instanceof SVGNodeContainer ) { $ this -> addChildren ( $ node , $ xml , $ namespaces ) ; } return $ node ; }
Parses the given XML element into an instance of a SVGNode subclass.
Unknown node types use a generic implementation.

@param \SimpleXMLElement $xml        The XML element to parse.
@param string[]          $namespaces Array of allowed namespace prefixes.

@return SVGNode The parsed node.

@SuppressWarnings(PHPMD.ElseExpression)
Parses the given XML element into an instance of a SVGNode subclass . Unknown node types use a generic implementation .