src/ResourceBuilder.php
private function buildContentTypeCollection(array $data)
    {
        $items = \array_merge(
            $data['items'],
            $data['includes']['Entry'] ?? []
        );

        $ids = \array_map(function (array $item) {
            return 'Entry' === $item['sys']['type']
                ? $item['sys']['contentType']['sys']['id']
                : null;
        }, $items);

        $ids = \array_filter(\array_unique($ids), function ($id): bool {
            return $id && !$this->resourcePool->has('ContentType', $id);
        });

        if ($ids) {
            $query = (new Query())
                ->where('sys.id[in]', \implode(',', $ids))
            ;
            $this->client->getContentTypes($query);
        }
    }
private function buildContentTypeCollection(array $data)
    {
        $items = \array_merge(
            $data['items'],
            $data['includes']['Entry'] ?? []
        );

        $ids = \array_map(function (array $item) {
            return 'Entry' === $item['sys']['type']
                ? $item['sys']['contentType']['sys']['id']
                : null;
        }, $items);

        $ids = \array_filter(\array_unique($ids), function ($id): bool {
            return $id && !$this->resourcePool->has('ContentType', $id);
        });

        if ($ids) {
            $query = (new Query())
                ->where('sys.id[in]', \implode(',', $ids))
            ;
            $this->client->getContentTypes($query);
        }
    }
We extract content types that need to be fetched from a response array.
This way we can use a collective query rather than making separate queries
for every content type.

@param array $data