public function getPortableElementByClass($portableElementClass, Element $qtiItem, $useVersionAlias = false){
        $portableElements = [];

        $identifiers = array_map(function($portableElement){
            return $portableElement->getTypeIdentifier();
        }, $qtiItem->getComposingElements($portableElementClass));

        foreach($this->getPortableModelRegistry()->getModels() as $model){
            $phpClass = $model->getQtiElementClassName();
            if(is_subclass_of($phpClass, $portableElementClass)){
                $portableElements = array_merge($portableElements, array_filter($model->getRegistry()->getLatestRuntimes($useVersionAlias), function($data) use ($identifiers){
                    $portableElement = reset($data);
                    if(!empty($portableElement) && in_array($portableElement['typeIdentifier'], $identifiers)){
                        return true;
                    }
                    return false;
                }));
            }
        }

        /**
         * @deprecated do not use the returned baseUrl
         */
        return $portableElements;
    }
public function getPortableElementByClass($portableElementClass, Element $qtiItem, $useVersionAlias = false){
        $portableElements = [];

        $identifiers = array_map(function($portableElement){
            return $portableElement->getTypeIdentifier();
        }, $qtiItem->getComposingElements($portableElementClass));

        foreach($this->getPortableModelRegistry()->getModels() as $model){
            $phpClass = $model->getQtiElementClassName();
            if(is_subclass_of($phpClass, $portableElementClass)){
                $portableElements = array_merge($portableElements, array_filter($model->getRegistry()->getLatestRuntimes($useVersionAlias), function($data) use ($identifiers){
                    $portableElement = reset($data);
                    if(!empty($portableElement) && in_array($portableElement['typeIdentifier'], $identifiers)){
                        return true;
                    }
                    return false;
                }));
            }
        }

        /**
         * @deprecated do not use the returned baseUrl
         */
        return $portableElements;
    }
public function getPortableElementByClass ( $ portableElementClass , Element $ qtiItem , $ useVersionAlias = false ) { $ portableElements = [ ] ; $ identifiers = array_map ( function ( $ portableElement ) { return $ portableElement -> getTypeIdentifier ( ) ; } , $ qtiItem -> getComposingElements ( $ portableElementClass ) ) ; foreach ( $ this -> getPortableModelRegistry ( ) -> getModels ( ) as $ model ) { $ phpClass = $ model -> getQtiElementClassName ( ) ; if ( is_subclass_of ( $ phpClass , $ portableElementClass ) ) { $ portableElements = array_merge ( $ portableElements , array_filter ( $ model -> getRegistry ( ) -> getLatestRuntimes ( $ useVersionAlias ) , function ( $ data ) use ( $ identifiers ) { $ portableElement = reset ( $ data ) ; if ( ! empty ( $ portableElement ) && in_array ( $ portableElement [ 'typeIdentifier' ] , $ identifiers ) ) { return true ; } return false ; } ) ) ; } } /**
         * @deprecated do not use the returned baseUrl
         */ return $ portableElements ; }
Get the array of portable elements used in qti item object by its php class
@param string $portableElementClass - PORTABLE_CLASS_INTERACTION or PORTABLE_CLASS_INFOCONTROL
@param Element $qtiItem
@return array
Get the array of portable elements used in qti item object by its php class