* @author Jérôme Bogaerts * @author Camille Moyon */ class taoItems_models_classes_search_ItemContentTokenizer implements ResourceTokenizer { use \oat\generis\model\OntologyAwareTrait; /** * Find item model tokenizer and send request to it to extract tokens * * @param core_kernel_classes_Resource $resource * @return array */ public function getStrings(\core_kernel_classes_Resource $resource) { $tokenizer = $this->getItemContentTokenizer($resource); if (is_null($tokenizer)) { return []; } return $tokenizer->getStrings($resource); } /** * Get item content tokenizer associated to $resource e.q. item model * If not return null * * @param core_kernel_classes_Resource $resource * @return null|taoItems_models_classes_itemModel */ protected function getItemContentTokenizer(core_kernel_classes_Resource $resource) { $itemService = taoItems_models_classes_ItemsService::singleton(); $model = $itemService->getItemModel($resource); if (! is_null($model)) { $impl = $itemService->getItemModelImplementation($model); if (! is_null($impl)) { if ($impl instanceof IndexableItemModel) { return $impl->getItemContentTokenizer(); } } } return null; } }