private function buildInfoControl(DOMElement $data){

        $infoControl = null;

        $picClass = $this->getPicClass($data);

        if(!empty($picClass)){

            $ns = null;
            foreach($this->item->getNamespaces() as $name => $uri){
                if($picClass::NS_URI === $uri){
                    $ns = new QtiNamespace($uri, $name);
                }
            }
            if(is_null($ns)){
                $pciNodes = $this->queryXPathChildren(array('portableInfoControl'), $data);
                if($pciNodes->length){
                    $ns = new QtiNamespace($pciNodes->item(0)->getAttribute('xmlns'));
                }
            }

            //use tao's implementation of portable custom interaction
            $infoControl = new PortableInfoControl($this->extractAttributes($data), $this->item);
            $infoControl->feed($this, $data, $ns);
        }else{

            $ciClass = '';
            $classes = $data->getAttribute('class');
            $classeNames = preg_split('/\s+/', $classes);
            foreach($classeNames as $classeName){
                $ciClass = InfoControlRegistry::getInfoControlByName($classeName);
                if($ciClass){
                    $infoControl = new $ciClass($this->extractAttributes($data), $this->item);
                    $infoControl->feed($this, $data);
                    break;
                }
            }

            if(!$ciClass){
                throw new UnsupportedQtiElement($data);
            }
        }

        return $infoControl;
    }
private function buildInfoControl(DOMElement $data){

        $infoControl = null;

        $picClass = $this->getPicClass($data);

        if(!empty($picClass)){

            $ns = null;
            foreach($this->item->getNamespaces() as $name => $uri){
                if($picClass::NS_URI === $uri){
                    $ns = new QtiNamespace($uri, $name);
                }
            }
            if(is_null($ns)){
                $pciNodes = $this->queryXPathChildren(array('portableInfoControl'), $data);
                if($pciNodes->length){
                    $ns = new QtiNamespace($pciNodes->item(0)->getAttribute('xmlns'));
                }
            }

            //use tao's implementation of portable custom interaction
            $infoControl = new PortableInfoControl($this->extractAttributes($data), $this->item);
            $infoControl->feed($this, $data, $ns);
        }else{

            $ciClass = '';
            $classes = $data->getAttribute('class');
            $classeNames = preg_split('/\s+/', $classes);
            foreach($classeNames as $classeName){
                $ciClass = InfoControlRegistry::getInfoControlByName($classeName);
                if($ciClass){
                    $infoControl = new $ciClass($this->extractAttributes($data), $this->item);
                    $infoControl->feed($this, $data);
                    break;
                }
            }

            if(!$ciClass){
                throw new UnsupportedQtiElement($data);
            }
        }

        return $infoControl;
    }
private function buildInfoControl ( DOMElement $ data ) { $ infoControl = null ; $ picClass = $ this -> getPicClass ( $ data ) ; if ( ! empty ( $ picClass ) ) { $ ns = null ; foreach ( $ this -> item -> getNamespaces ( ) as $ name => $ uri ) { if ( $ picClass :: NS_URI === $ uri ) { $ ns = new QtiNamespace ( $ uri , $ name ) ; } } if ( is_null ( $ ns ) ) { $ pciNodes = $ this -> queryXPathChildren ( array ( 'portableInfoControl' ) , $ data ) ; if ( $ pciNodes -> length ) { $ ns = new QtiNamespace ( $ pciNodes -> item ( 0 ) -> getAttribute ( 'xmlns' ) ) ; } } //use tao's implementation of portable custom interaction $ infoControl = new PortableInfoControl ( $ this -> extractAttributes ( $ data ) , $ this -> item ) ; $ infoControl -> feed ( $ this , $ data , $ ns ) ; } else { $ ciClass = '' ; $ classes = $ data -> getAttribute ( 'class' ) ; $ classeNames = preg_split ( '/\s+/' , $ classes ) ; foreach ( $ classeNames as $ classeName ) { $ ciClass = InfoControlRegistry :: getInfoControlByName ( $ classeName ) ; if ( $ ciClass ) { $ infoControl = new $ ciClass ( $ this -> extractAttributes ( $ data ) , $ this -> item ) ; $ infoControl -> feed ( $ this , $ data ) ; break ; } } if ( ! $ ciClass ) { throw new UnsupportedQtiElement ( $ data ) ; } } return $ infoControl ; }
Parse and build a info control

@param DOMElement $data
@return InfoControl
@throws ParsingException
Parse and build a info control