site = WebflowSite::byId($webflowApiClient, '5ebabfe546c816388d66c03a'); $this->apiClient = $webflowApiClient; $this->logger= $l; } public function supports(string $resourceClass, ?string $operationName = null, array $context = []): bool { return in_array($resourceClass, [ WebflowCollection::class, WebflowItem::class, ]); } public function getCollection(string $resourceClass, ?string $operationName = null, array $context = []): \Generator { switch ($resourceClass) { case WebflowCollection::class: foreach($this->site->getCollections() as $col) yield new WebflowCollection($col); break; case WebflowItem::class: if (isset($context['filters']) && isset($context['filters']['cid'])) { $col = WebflowApiCollection::byId($this->apiClient, $context['filters']['cid']); foreach ($col->getItems() as $item) yield new WebflowItem($item); break; } foreach ($this->site->getCollections() as $col) foreach ($col->getItems() as $item) yield new WebflowItem($item); break; } return null; } }