19 declare(strict_types=1);
32 class Handler implements SchemaFolderInterface
42 SchemaInfoFactoryInterface $schema_info_factory,
47 $this->collection = $this->schema_info_factory->collection();
51 public function getLatest(
string $type,
string $sub_type =
''): SchemaInfoInterface|
null 53 return $this->collection->getLatest($type, $sub_type);
58 return $this->collection->getByVersion($version, $type, $sub_type);
63 return $this->collection->getByVersionOrLatest($version, $type, $sub_type);
71 $file->getExtension() !== self::FILE_EXTENSION ||
72 !str_starts_with($file->getFilename(), self::FILE_PREFIX)
77 if (preg_match(
'/ilias_([a-zA-Z]+)(_([a-zA-Z]+))?_([3-9]|([1-9][0-9]+))_?([0-9]+)?.xsd/', $file->getFilename(), $matches) !== 1) {
78 $this->
logger->debug(
'Ignoring file (match): ' . $file->getFilename());
82 $element = $this->schema_info_factory->handler()
83 ->withSplFileInfo(
new SplFileInfo($file->getPathname()))
84 ->withComponent((
string) $matches[1])
85 ->withSubtype((
string) $matches[3])
86 ->withVersion(
new Version($matches[4] . (($matches[6] ??
'') ?
'.' . $matches[6] :
'')));
87 $this->collection = $this->collection
88 ->withElement($element);
89 $this->
logger->debug($file->getFilename() .
' matches');
getLatest(string $type, string $sub_type='')
const SCHEMA_DEFINITION_LOCATION
SchemaInfoCollectionInterface $collection
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(SchemaInfoFactoryInterface $schema_info_factory, ilLogger $logger)
getByVersionOrLatest(Version $version, string $type, string $sub_type='')
SchemaInfoFactoryInterface $schema_info_factory
A version number that consists of three numbers (major, minor, patch).
getByVersion(Version $version, string $type, string $sub_type='')