private function getPortableElementClass(DOMElement $data, $superClassName, $portableElementNodeName){

        $portableElementClasses = $this->getPortableElementSubclasses($superClassName);

        //start searching from globally declared namespace
        foreach($this->item->getNamespaces() as $name => $uri){
            foreach($portableElementClasses as $class){
                if($uri === $class::NS_URI
                    && $this->queryXPathChildren(array($portableElementNodeName), $data, $name)->length){
                    return $class;
                }
            }
        }

        //not found as a global namespace definition, try local namespace
        if($this->queryXPathChildren(array($portableElementNodeName), $data)->length){
            $pciNode = $this->queryXPathChildren(array($portableElementNodeName), $data)[0];
            $xmlns = $pciNode->getAttribute('xmlns');
            foreach($portableElementClasses as $phpClass){
                if($phpClass::NS_URI === $xmlns){
                    return $phpClass;
                }
            }
        }

        //not a known portable element type
        return null;
    }
private function getPortableElementClass(DOMElement $data, $superClassName, $portableElementNodeName){

        $portableElementClasses = $this->getPortableElementSubclasses($superClassName);

        //start searching from globally declared namespace
        foreach($this->item->getNamespaces() as $name => $uri){
            foreach($portableElementClasses as $class){
                if($uri === $class::NS_URI
                    && $this->queryXPathChildren(array($portableElementNodeName), $data, $name)->length){
                    return $class;
                }
            }
        }

        //not found as a global namespace definition, try local namespace
        if($this->queryXPathChildren(array($portableElementNodeName), $data)->length){
            $pciNode = $this->queryXPathChildren(array($portableElementNodeName), $data)[0];
            $xmlns = $pciNode->getAttribute('xmlns');
            foreach($portableElementClasses as $phpClass){
                if($phpClass::NS_URI === $xmlns){
                    return $phpClass;
                }
            }
        }

        //not a known portable element type
        return null;
    }
private function getPortableElementClass ( DOMElement $ data , $ superClassName , $ portableElementNodeName ) { $ portableElementClasses = $ this -> getPortableElementSubclasses ( $ superClassName ) ; //start searching from globally declared namespace foreach ( $ this -> item -> getNamespaces ( ) as $ name => $ uri ) { foreach ( $ portableElementClasses as $ class ) { if ( $ uri === $ class :: NS_URI && $ this -> queryXPathChildren ( array ( $ portableElementNodeName ) , $ data , $ name ) -> length ) { return $ class ; } } } //not found as a global namespace definition, try local namespace if ( $ this -> queryXPathChildren ( array ( $ portableElementNodeName ) , $ data ) -> length ) { $ pciNode = $ this -> queryXPathChildren ( array ( $ portableElementNodeName ) , $ data ) [ 0 ] ; $ xmlns = $ pciNode -> getAttribute ( 'xmlns' ) ; foreach ( $ portableElementClasses as $ phpClass ) { if ( $ phpClass :: NS_URI === $ xmlns ) { return $ phpClass ; } } } //not a known portable element type return null ; }
Get the PCI class associated to a dom node based on its namespace
Returns null if not a known PCI model

@param DOMElement $data
@return null
Get the PCI class associated to a dom node based on its namespace Returns null if not a known PCI model