private function setLocales(array $locales)
    {
        $locales = $this->filterLocales($locales);
        uasort($locales, [ $this, 'sortLocalesByPriority' ]);

        $this->locales   = [];
        $this->languages = [];
        foreach ($locales as $langCode => $locale) {
            $this->locales[$langCode] = $locale;
            $this->languages[] = $langCode;
        }

        if (empty($this->locales)) {
            throw new InvalidArgumentException(
                'Locales can not be empty.'
            );
        }
    }
private function setLocales(array $locales)
    {
        $locales = $this->filterLocales($locales);
        uasort($locales, [ $this, 'sortLocalesByPriority' ]);

        $this->locales   = [];
        $this->languages = [];
        foreach ($locales as $langCode => $locale) {
            $this->locales[$langCode] = $locale;
            $this->languages[] = $langCode;
        }

        if (empty($this->locales)) {
            throw new InvalidArgumentException(
                'Locales can not be empty.'
            );
        }
    }
private function setLocales ( array $ locales ) { $ locales = $ this -> filterLocales ( $ locales ) ; uasort ( $ locales , [ $ this , 'sortLocalesByPriority' ] ) ; $ this -> locales = [ ] ; $ this -> languages = [ ] ; foreach ( $ locales as $ langCode => $ locale ) { $ this -> locales [ $ langCode ] = $ locale ; $ this -> languages [ ] = $ langCode ; } if ( empty ( $ this -> locales ) ) { throw new InvalidArgumentException ( 'Locales can not be empty.' ) ; } }
Set the available languages.

Ensure that explicitely inactive locales are excluded and that the required
values are set on the locales configuration structure.

This method is only called from the constructor.

@param  array $locales The locales configuration structure.
@throws InvalidArgumentException If there are no active locales.
@return void
Set the available languages .