*/ private array $entries = []; public function jsonDeserialize(array|string $data): static { if (is_string($data)) { $data = json_decode($data, true); } $this->entries = []; foreach ($data as $name => $store) { if (!is_string($name) || preg_match('/^[a-z][a-z0-9-]*$/', $name) !== 1) { throw new InvalidArgumentException('Invalid logical system-store name'); } if (!is_array($store)) { throw new InvalidArgumentException('Invalid tenant store configuration entry'); } $this->entries[$name] = StoreReference::fromArray($store); } return $this; } public function jsonSerialize(): array { return array_map( static fn(StoreReference $store): array => $store->toArray(), $this->entries, ); } public function store(string $name): ?StoreReference { return $this->entries[$name] ?? null; } /** @return array */ public function all(): array { return $this->entries; } }