private function setDefaultLocale($lang)
    {
        if ($lang === null) {
            $this->defaultLanguage = $this->languages[0];
            return;
        }

        if (!$this->hasLocale($lang)) {
            if (!is_string($lang)) {
                $lang = is_object($lang) ? get_class($lang) : gettype($lang);
            }

            throw new InvalidArgumentException(sprintf(
                'Unsupported default language; must be one of "%s", received "%s"',
                implode(', ', $this->availableLocales()),
                $lang
            ));
        }

        $this->defaultLanguage = $lang;
    }
private function setDefaultLocale($lang)
    {
        if ($lang === null) {
            $this->defaultLanguage = $this->languages[0];
            return;
        }

        if (!$this->hasLocale($lang)) {
            if (!is_string($lang)) {
                $lang = is_object($lang) ? get_class($lang) : gettype($lang);
            }

            throw new InvalidArgumentException(sprintf(
                'Unsupported default language; must be one of "%s", received "%s"',
                implode(', ', $this->availableLocales()),
                $lang
            ));
        }

        $this->defaultLanguage = $lang;
    }
private function setDefaultLocale ( $ lang ) { if ( $ lang === null ) { $ this -> defaultLanguage = $ this -> languages [ 0 ] ; return ; } if ( ! $ this -> hasLocale ( $ lang ) ) { if ( ! is_string ( $ lang ) ) { $ lang = is_object ( $ lang ) ? get_class ( $ lang ) : gettype ( $ lang ) ; } throw new InvalidArgumentException ( sprintf ( 'Unsupported default language; must be one of "%s", received "%s"' , implode ( ', ' , $ this -> availableLocales ( ) ) , $ lang ) ) ; } $ this -> defaultLanguage = $ lang ; }
Set the default language.

@param  string|null $lang The default language code.
If NULL, the first language is assigned.
@throws InvalidArgumentException If the language is invalid.
@return void
Set the default language .