src/Resource/Environment.php
public function getLocale(string $code): Locale
    {
        foreach ($this->locales as $locale) {
            if ($locale->getCode() === $code) {
                return $locale;
            }
        }

        throw new \InvalidArgumentException(\sprintf(
            'No locale with code "%s" exists in this environment.',
            $code
        ));
    }
public function getLocale(string $code): Locale
    {
        foreach ($this->locales as $locale) {
            if ($locale->getCode() === $code) {
                return $locale;
            }
        }

        throw new \InvalidArgumentException(\sprintf(
            'No locale with code "%s" exists in this environment.',
            $code
        ));
    }
@param string $code Code of the locale to fetch the object for

@throws \InvalidArgumentException When no locale with the given code exists

@return Locale