>|null */ private ?array $items = null; /** @return array> */ public function snapshots(): array { if ($this->items !== null) { return $this->items; } $contents = file_get_contents(base_path('docs/investmoz/unification/approved-administrative-boundaries-20261024.json')); if ($contents === false || ! hash_equals(self::HASH, hash('sha256', str_replace("\r\n", "\n", $contents)))) { throw new RuntimeException('Approved administrative boundary manifest changed.'); } $manifest = json_decode($contents, true, 512, JSON_THROW_ON_ERROR); if (count($manifest['items']) !== 408) { throw new RuntimeException('Exact 408-boundary scope required.'); } $this->items = array_column($manifest['items'], null, 'id'); return $this->items; } public function allows(string $id, string $territoryId, string $geometryHash, string $propertiesHash): bool { $item = $this->snapshots()[$id] ?? null; return $item !== null && $item['territory_id'] === $territoryId && hash_equals($item['geometry_sha256'], $geometryHash) && hash_equals($item['properties_sha256'], $propertiesHash); } }