src/Client.php
public function getEnvironment(): Environment
    {
        if ($this->resourcePool->has('Environment', $this->environmentId)) {
            /** @var Environment $environment */
            $environment = $this->resourcePool->get('Environment', $this->environmentId);

            return $environment;
        }

        // Because in the CDA there is no native endpoint for handling environments,
        // we create a fake one in order to assign the collection of locales to it.
        // We could be using any sort of fake resource for this, like a "LocaleCollection" type,
        // but given that previously locales were part of the space, whereas now they conceptually
        // belong to an environment, we choose this kind of abstraction.
        $locales = $this->callApi(
            'GET',
            '/spaces/'.$this->spaceId.'/environments/'.$this->environmentId.'/locales'
        );
        $environmentData = [
            'sys' => [
                'id' => $this->environmentId,
                'type' => 'Environment',
            ],
            'locales' => $locales['items'],
        ];

        /** @var Environment $environment */
        $environment = $this->builder->build($environmentData);

        return $environment;
    }
public function getEnvironment(): Environment
    {
        if ($this->resourcePool->has('Environment', $this->environmentId)) {
            /** @var Environment $environment */
            $environment = $this->resourcePool->get('Environment', $this->environmentId);

            return $environment;
        }

        // Because in the CDA there is no native endpoint for handling environments,
        // we create a fake one in order to assign the collection of locales to it.
        // We could be using any sort of fake resource for this, like a "LocaleCollection" type,
        // but given that previously locales were part of the space, whereas now they conceptually
        // belong to an environment, we choose this kind of abstraction.
        $locales = $this->callApi(
            'GET',
            '/spaces/'.$this->spaceId.'/environments/'.$this->environmentId.'/locales'
        );
        $environmentData = [
            'sys' => [
                'id' => $this->environmentId,
                'type' => 'Environment',
            ],
            'locales' => $locales['items'],
        ];

        /** @var Environment $environment */
        $environment = $this->builder->build($environmentData);

        return $environment;
    }
{@inheritdoc}