/**
  * {@inheritdoc}
  */
 public function getLocaleCode()
 {
     $availableLocalesCodes = $this->localeProvider->getAvailableLocalesCodes();
     $localeCode = $this->localeProvider->getDefaultLocaleCode();
     if (!in_array($localeCode, $availableLocalesCodes, true)) {
         throw LocaleNotFoundException::notAvailable($localeCode, $availableLocalesCodes);
     }
     return $localeCode;
 }
 /**
  * {@inheritdoc}
  */
 public function getLocaleCode()
 {
     $availableLocalesCodes = $this->localeProvider->getAvailableLocalesCodes();
     try {
         $localeCode = $this->localeStorage->get($this->channelContext->getChannel());
     } catch (ChannelNotFoundException $exception) {
         throw new LocaleNotFoundException(null, $exception);
     }
     if (!in_array($localeCode, $availableLocalesCodes, true)) {
         throw LocaleNotFoundException::notAvailable($localeCode, $availableLocalesCodes);
     }
     return $localeCode;
 }
 /**
  * {@inheritdoc}
  */
 public function getLocaleCode()
 {
     $request = $this->requestStack->getMasterRequest();
     if (null === $request) {
         throw new LocaleNotFoundException('No master request available.');
     }
     $localeCode = $request->attributes->get('_locale');
     if (null === $localeCode) {
         throw new LocaleNotFoundException('No locale attribute is set on the master request.');
     }
     $availableLocalesCodes = $this->localeProvider->getAvailableLocalesCodes();
     if (!in_array($localeCode, $availableLocalesCodes, true)) {
         throw LocaleNotFoundException::notAvailable($localeCode, $availableLocalesCodes);
     }
     return $localeCode;
 }