items = $initialization; } public function count(): int { $this->initialize(); return count($this->items); } private function initialize(): void { if ($this->items instanceof \Closure) { $this->items = ($this->items)(); } } public function getIterator(): \Iterator { $this->initialize(); return new \ArrayIterator($this->items); } public function __toString(): string { return (string)$this->fieldValue; } public function offsetExists(mixed $offset): bool { $this->initialize(); return isset($this->items[$offset]); } public function offsetGet(mixed $offset): mixed { $this->initialize(); return $this->items[$offset] ?? null; } public function offsetSet(mixed $offset, mixed $value): void { if ($value instanceof Folder === false) { throw new \InvalidArgumentException( 'Modifying the folder collection is only allowed by setting a value of type Folder.', 1724136133 ); } $this->items[$offset] = $value; } public function offsetUnset(mixed $offset): void { throw new \RuntimeException('Removing items from the folder collection is not implemented.', 1724136134); } }