public function setRegion($region, $locale = null)
    {
        $region = strtolower($region);
        $locales = $this->getSupportedLocales($region);

        if (in_array($region, $this->getSupportedRegions()) && $locales !== false) {
            $this->options->set('region', $region);
        } else {
            throw new \InvalidArgumentException(sprintf('The region `%s` is not supported.', $region));
        }

        if ($locale === null) {
            $this->options->set('locale', $locales[0]);
        } else {
            if ($locales !== false && in_array($locale, $locales)) {
                $this->options->set('locale', $locale);
            } else {
                throw new \InvalidArgumentException(sprintf('The locale `%s` for region `%s` is not supported.', $locale, $region));
            }
        }
    }
public function setRegion($region, $locale = null)
    {
        $region = strtolower($region);
        $locales = $this->getSupportedLocales($region);

        if (in_array($region, $this->getSupportedRegions()) && $locales !== false) {
            $this->options->set('region', $region);
        } else {
            throw new \InvalidArgumentException(sprintf('The region `%s` is not supported.', $region));
        }

        if ($locale === null) {
            $this->options->set('locale', $locales[0]);
        } else {
            if ($locales !== false && in_array($locale, $locales)) {
                $this->options->set('locale', $locale);
            } else {
                throw new \InvalidArgumentException(sprintf('The locale `%s` for region `%s` is not supported.', $locale, $region));
            }
        }
    }
public function setRegion ( $ region , $ locale = null ) { $ region = strtolower ( $ region ) ; $ locales = $ this -> getSupportedLocales ( $ region ) ; if ( in_array ( $ region , $ this -> getSupportedRegions ( ) ) && $ locales !== false ) { $ this -> options -> set ( 'region' , $ region ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'The region `%s` is not supported.' , $ region ) ) ; } if ( $ locale === null ) { $ this -> options -> set ( 'locale' , $ locales [ 0 ] ) ; } else { if ( $ locales !== false && in_array ( $ locale , $ locales ) ) { $ this -> options -> set ( 'locale' , $ locale ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'The locale `%s` for region `%s` is not supported.' , $ locale , $ region ) ) ; } } }
Set the region

@param string      $region Region
@param null|string $locale Locale

@return void
Set the region