models/classes/creator/CreatorItems.php
public function getQtiItems(\core_kernel_classes_Class $itemClass, $format = 'list', $search = '', $offset = 0, $limit = 30)
    {
        $propertyFilters = [];

        if($this->hasOption(self::ITEM_MODEL_SEARCH_OPTION) && $this->getOption(self::ITEM_MODEL_SEARCH_OPTION) !== false){
            $propertyFilters[self::PROPERTY_ITEM_MODEL_URI] = $this->getOption(self::ITEM_MODEL_SEARCH_OPTION);
        }

        if($this->hasOption(self::ITEM_CONTENT_SEARCH_OPTION) && $this->getOption(self::ITEM_MODEL_SEARCH_OPTION) !== false){
            $propertyFilters[self::PROPERTY_ITEM_CONTENT_URI] = '*';
        }

        if(is_string($search) && strlen(trim($search)) > 0){
            $propertyFilters[self::LABEL_URI] = $search;
        }
        if(is_array($search)){
            foreach($search as $uri => $value){
                if( is_string($uri) &&
                    (is_string($value) && strlen(trim($value)) > 0) ||
                    (is_array($value) && count($value) > 0) ) {
                    $propertyFilters[$uri] = $value;
                }
            }
        }

        $result = [];

        //whitelisting's mandatory to prevent hijacking the dependency injection
        if(in_array($format, self::$formats)){

            //load the lookup dynamically using the format
            $itemLookup = $this->getServiceLocator()->get(self::SERVICE_ID . '/' . $format);
            if(!is_null($itemLookup) && $itemLookup instanceof ItemLookup){
                $result = $itemLookup->getItems($itemClass, $propertyFilters, $offset, $limit);
            }
        }
        return $result;
    }
public function getQtiItems(\core_kernel_classes_Class $itemClass, $format = 'list', $search = '', $offset = 0, $limit = 30)
    {
        $propertyFilters = [];

        if($this->hasOption(self::ITEM_MODEL_SEARCH_OPTION) && $this->getOption(self::ITEM_MODEL_SEARCH_OPTION) !== false){
            $propertyFilters[self::PROPERTY_ITEM_MODEL_URI] = $this->getOption(self::ITEM_MODEL_SEARCH_OPTION);
        }

        if($this->hasOption(self::ITEM_CONTENT_SEARCH_OPTION) && $this->getOption(self::ITEM_MODEL_SEARCH_OPTION) !== false){
            $propertyFilters[self::PROPERTY_ITEM_CONTENT_URI] = '*';
        }

        if(is_string($search) && strlen(trim($search)) > 0){
            $propertyFilters[self::LABEL_URI] = $search;
        }
        if(is_array($search)){
            foreach($search as $uri => $value){
                if( is_string($uri) &&
                    (is_string($value) && strlen(trim($value)) > 0) ||
                    (is_array($value) && count($value) > 0) ) {
                    $propertyFilters[$uri] = $value;
                }
            }
        }

        $result = [];

        //whitelisting's mandatory to prevent hijacking the dependency injection
        if(in_array($format, self::$formats)){

            //load the lookup dynamically using the format
            $itemLookup = $this->getServiceLocator()->get(self::SERVICE_ID . '/' . $format);
            if(!is_null($itemLookup) && $itemLookup instanceof ItemLookup){
                $result = $itemLookup->getItems($itemClass, $propertyFilters, $offset, $limit);
            }
        }
        return $result;
    }
Retrieve QTI Items for the given parameters
@param \core_kernel_classes_Class $itemClass the item class
@param string $format the lookup format
@param string|array  $search to filter by label if a string or provides the search filters
@param int $offset for paging
@param int $limit  for paging
@return array the items