getPropertyValues( $this->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_CONTENT) ); if (empty($ontologyFiles)) { return []; } } catch (\core_kernel_classes_EmptyProperty $e) { return []; } $file = $this->getFileReferenceSerializer() ->unserializeDirectory(reset($ontologyFiles)) ->getFile(Service::QTI_ITEM_FILE); if (!$file->exists()) { return []; } $content = $file->read(); if (empty($content)) { return []; } $dom = new \DOMDocument(); $dom->loadXML($content); $xpath = new \DOMXPath($dom); $textNodes = $xpath->query('//text()'); unset($xpath); $contentStrings = []; foreach ($textNodes as $textNode) { if ($this->applyFilters($textNode->wholeText)) { $contentStrings[] = trim($textNode->wholeText); } } return $contentStrings; } protected function getFileReferenceSerializer(): FileReferenceSerializer { return $this->getServiceManager()->get(FileReferenceSerializer::SERVICE_ID); } protected function applyFilters(string $data): string { /** @var TokenFilterInterface $filter */ foreach ($this->getOption(self::OPTION_FILTERS, []) as $filter) { $output = $filter->filter($output ?? $data); } return $output ?? $data; } }