19 declare(strict_types=1);
39 $this->
logger = $DIC->logger()->exp();
46 $collection = $this->
getByType($type, $sub_type);
47 if ($collection->count() === 0) {
50 $latest = $collection->
offsetGet($collection->count() - 1);
51 return $latest->getFile();
56 $collection = $this->
getByType($type, $sub_type);
57 foreach ($collection as $schema_info) {
58 if ($schema_info->getVersion()->equals($version)) {
59 return $schema_info->getFile();
67 $collection = $this->
getByType($type, $sub_type);
68 foreach ($collection as $schema_info) {
69 if ($schema_info->getVersion()->equals($version)) {
70 return $schema_info->getFile();
73 return $this->
getLatest($type, $sub_type);
79 foreach ($this->collection as $schema_info) {
80 if ($schema_info->getComponent() === $component && $schema_info->getSubtype() === $sub_type) {
81 $collection[] = $schema_info;
82 $this->
logger->info(
'Found version: ' . $schema_info->getFile()->getFilename());
100 foreach ($collection as $schema_info) {
101 $sorted[] = $schema_info;
108 foreach (
new \DirectoryIterator(self::SCHEMA_DEFINITION_LOCATION) as $file) {
109 if ($file->isDot()) {
110 $this->
logger->debug(
'Ignoring file (dot file): ' . $file->getFilename());
113 if ($file->getExtension() !==
'xsd') {
114 $this->
logger->debug(
'Ignoring file (!xsd): ' . $file->getFilename());
117 $parts = explode(
'_', $file->getFilename());
119 $this->
logger->debug(
'Ignoring file (!_separated): ' . $file->getFilename());
122 if (
$parts[0] !==
'ilias') {
123 $this->
logger->debug(
'Ignoring file (!ilias): ' . $file->getFilename() .
' ' .
$parts[0]);
127 if (preg_match(
'/ilias_([a-zA-Z]+)(_([a-zA-Z]+))?_([3-9]|([1-9][0-9]+))_?([0-9]+)?.xsd/', $file->getFilename(), $matches) !== 1) {
128 $this->
logger->debug(
'Ignoring file (match): ' . $file->getFilename());
134 (
string) $matches[1],
135 (string) $matches[3],
136 new Version((
string) $matches[4] . (($matches[6] ??
'') ?
'.' . $matches[6] :
''))
138 $this->
logger->debug($file->getFilename() .
' matches');
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
getByVersionOrLatest(Version $version, string $type, string $sub_type='')
const SCHEMA_DEFINITION_LOCATION
getByVersion(Version $version, string $type, string $sub_type='')
ilXmlSchemaInfoCollection $collection
sortByVersion(ilXmlSchemaInfoCollection $collection)
getByType(string $component, string $sub_type='')
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
A version number that consists of three numbers (major, minor, patch).
getLatest(string $type, string $sub_type='')