protected function isValidLocale($locale) { if (!in_array($locale, $this->availableLocales)) { throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $locale)); } return true; }