19declare(strict_types=1);
40 $this->entries = array_values(
$entries);
49 $stored = trim($stored);
55 static fn(
string $s):
string => trim($s),
60 foreach (
$parts as $part) {
67 }
catch (\Throwable) {
78 return \count($this->entries);
87 if ($index < 0 || !\array_key_exists($index, $this->entries)) {
91 $el = $this->entries[$index];
101 $strings = array_map(
102 static fn(
URI|
string $el):
string => $el instanceof
URI ? (
string) $el : (
string) $el,
106 return implode(
',', $strings);
122 foreach ($this->entries as $el) {
123 if (!($el instanceof
URI)) {
137 if (\
count($this->entries) < 2) {
141 $rotated = array_merge(
142 \array_slice($this->entries, 1),
146 return new self($rotated);
155 if ($index < 0 || !\array_key_exists($index, $this->entries)) {
159 $entry = $this->entries[$index];
161 \array_slice($this->entries, 0, $index),
162 \array_slice($this->entries, $index + 1)
165 return new self(array_merge([$entry], $rest));
176 foreach ($this->entries as $index => $entry) {
177 if ($entry instanceof
URI) {
178 yield $index => $entry;
The scope of this class is split ilias-conform URI's into components.
Value object representing a list of LDAP server URLs (primary plus fallbacks).
getInvalidParts()
Entries that could not be parsed as URI (for GUI validation messages).
rotate()
New list with first entry moved to the end (for persisted fallback rotation).
toString()
Convert to stored form (comma-separated string for database and form).
static fromString(string $stored)
Create from string representation (comma-separated, as stored in DB or form).
getConnectionStringAtIndex(int $index)
Connection string for ldap_connect() at the given index (0 = primary).
count()
Returns the number of entries (valid and invalid).
validUrls()
Iterate over valid URL entries only (invalid/raw string entries are skipped).
__construct(array $entries=[])
withPrimaryAt(int $index)
New list with the entry at $index moved to primary (index 0).
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts