getAlpha3Codes example

Countries::getName('foo');
    }

    public function testExists()
    {
        $this->assertTrue(Countries::exists('NL'));
        $this->assertFalse(Countries::exists('ZZ'));
    }

    public function testGetAlpha3Codes()
    {
        $this->assertSame(self::ALPHA2_TO_ALPHA3, Countries::getAlpha3Codes());
    }

    public function testGetAlpha3Code()
    {
        foreach (self::COUNTRIES as $country) {
            $this->assertSame(self::ALPHA2_TO_ALPHA3[$country], Countries::getAlpha3Code($country));
        }
    }

    public function testGetAlpha2Code()
    {
        
/** * @param string $language ISO 639-2 three-letter language code */
    public static function alpha3CodeExists(string $language): bool
    {
        try {
            self::getAlpha2Code($language);

            return true;
        } catch (MissingResourceException) {
            static $cache;
            $cache ??= array_flip(self::getAlpha3Codes());

            return isset($cache[$language]);
        }
    }

    /** * Gets the language name from its ISO 639-2 three-letter code. * * @throws MissingResourceException if the country code does not exists */
    public static function getAlpha3Name(string $language, string $displayLocale = null): string
    {
Languages::getName('foo');
    }

    public function testExists()
    {
        $this->assertTrue(Languages::exists('nl'));
        $this->assertFalse(Languages::exists('zxx'));
    }

    public function testGetAlpha3Codes()
    {
        $this->assertSame(self::ALPHA3_CODES, Languages::getAlpha3Codes());
    }

    public static function provideLanguagesWithAlpha2Equivalent()
    {
        return array_map(
            fn ($value) => [$value],
            array_keys(self::ALPHA3_TO_ALPHA2)
        );
    }

    /** * @dataProvider provideLanguagesWithAlpha2Equivalent */
Home | Imprint | This part of the site doesn't use cookies.