isSharedStimulus($mimeType) ? $this->getSharedStimulusExtractor()->extractMediaIdentifiers($content) : []; $this->getEventManager()->trigger(new MediaSavedEvent($id, $elementIds)); } /** * @param string|File $fileSource */ public function dispatchFromFile(string $id, $fileSource, string $mimeType = null): void { if (!$mimeType) { $mimeType = $fileSource instanceof File ? $fileSource->getMimeType() : tao_helpers_File::getMimeType($fileSource); } if ($this->isSharedStimulus($mimeType)) { $content = $fileSource instanceof File ? $fileSource->read() : file_get_contents($fileSource); } else { $content = ''; } $this->dispatchFromContent($id, $mimeType, $content); } private function isSharedStimulus($mimeType): bool { return $mimeType === MediaService::SHARED_STIMULUS_MIME_TYPE; } private function getEventManager(): EventManager { return $this->getServiceLocator()->get(EventManager::SERVICE_ID); } private function getSharedStimulusExtractor(): SharedStimulusMediaExtractor { return $this->getServiceLocator()->get(SharedStimulusMediaExtractor::class); } }