getSharedStimulusImporter() ]; } public function createByMediaId(string $id): tao_models_classes_import_ImportHandler { return $this->isQtiMedia($id) ? $this->getSharedStimulusImporter()->setInstanceUri($id) : new FileImporter($id); } private function isQtiMedia(string $id): bool { try { $class = $this->getOntology()->getClass($id); $mimeType = $class->getProperty('http://www.tao.lu/Ontologies/TAOMedia.rdf#mimeType'); return (string)$class->getOnePropertyValue($mimeType) === MediaService::SHARED_STIMULUS_MIME_TYPE; } catch (Throwable $exception) { return false; } } private function getOntology(): Ontology { return $this->getServiceLocator()->get(Ontology::SERVICE_ID); } private function getSharedStimulusImporter(): SharedStimulusImporter { return $this->getServiceLocator()->get(SharedStimulusImporter::class); } }