public static function validateLanguageCode(string $languageCode = null): string
    {
        // We allow empty languageCode in order to quit asking for more
        if (empty($languageCode)) {
            return '';
        }

        if (!preg_match('/^[a-z][a-z][a-z]-[A-Z][A-Z]$/', $languageCode)) {
            throw new InvalidArgumentException('Language code name is not valid.');
        }

        return $languageCode;
    }
public static function validateLanguageCode(string $languageCode = null): string
    {
        // We allow empty languageCode in order to quit asking for more
        if (empty($languageCode)) {
            return '';
        }

        if (!preg_match('/^[a-z][a-z][a-z]-[A-Z][A-Z]$/', $languageCode)) {
            throw new InvalidArgumentException('Language code name is not valid.');
        }

        return $languageCode;
    }
public static function validateLanguageCode ( string $ languageCode = null ) : string { // We allow empty languageCode in order to quit asking for more if ( empty ( $ languageCode ) ) { return '' ; } if ( ! preg_match ( '/^[a-z][a-z][a-z]-[A-Z][A-Z]$/' , $ languageCode ) ) { throw new InvalidArgumentException ( 'Language code name is not valid.' ) ; } return $ languageCode ; }
Validates language code.

@throws \InvalidArgumentException If validation did not pass
Validates language code .