protected function validateInput($locale = null)
    {
        // check for valid locale
        if ($locale && !$this->isValidLocale($locale)) {
            throw new Doozr_I18n_Service_Exception(
                sprintf('Invalid locale: %s', $locale)
            );
        }

        // get concrete locale
        $locale = ($locale !== null) ? $locale : $this->getClientPreferredLocale();

        $config = $this->getL10nConfigurationByLocale($locale);

        // check for redirect of current locale (e.g. from "en-gb" -> "en")
        try {
            $redirectLocale = $config->redirect->target;
            $this->locale   = $redirectLocale;
        } catch (Whoops\Exception\ErrorException $e) {
            $redirectLocale = null;
        } catch (Exception $e) {
            $redirectLocale = null;
        }

        // return a valid set of locale, redirect locale and the configuration
        return [
            'locale'   => $locale,
            'redirect' => $redirectLocale,
            'configuration'   => $config,
        ];
    }
protected function validateInput($locale = null)
    {
        // check for valid locale
        if ($locale && !$this->isValidLocale($locale)) {
            throw new Doozr_I18n_Service_Exception(
                sprintf('Invalid locale: %s', $locale)
            );
        }

        // get concrete locale
        $locale = ($locale !== null) ? $locale : $this->getClientPreferredLocale();

        $config = $this->getL10nConfigurationByLocale($locale);

        // check for redirect of current locale (e.g. from "en-gb" -> "en")
        try {
            $redirectLocale = $config->redirect->target;
            $this->locale   = $redirectLocale;
        } catch (Whoops\Exception\ErrorException $e) {
            $redirectLocale = null;
        } catch (Exception $e) {
            $redirectLocale = null;
        }

        // return a valid set of locale, redirect locale and the configuration
        return [
            'locale'   => $locale,
            'redirect' => $redirectLocale,
            'configuration'   => $config,
        ];
    }
protected function validateInput ( $ locale = null ) { // check for valid locale if ( $ locale && ! $ this -> isValidLocale ( $ locale ) ) { throw new Doozr_I18n_Service_Exception ( sprintf ( 'Invalid locale: %s' , $ locale ) ) ; } // get concrete locale $ locale = ( $ locale !== null ) ? $ locale : $ this -> getClientPreferredLocale ( ) ; $ config = $ this -> getL10nConfigurationByLocale ( $ locale ) ; // check for redirect of current locale (e.g. from "en-gb" -> "en") try { $ redirectLocale = $ config -> redirect -> target ; $ this -> locale = $ redirectLocale ; } catch ( Whoops \ Exception \ ErrorException $ e ) { $ redirectLocale = null ; } catch ( Exception $ e ) { $ redirectLocale = null ; } // return a valid set of locale, redirect locale and the configuration return [ 'locale' => $ locale , 'redirect' => $ redirectLocale , 'configuration' => $ config , ] ; }
This method is intend to validation the input locale and return data
required for running service.

@param string $locale The locale to prepare data for

@author Benjamin Carl <opensource@clickalicious.de>

@return array The prepared data

@throws Doozr_I18n_Service_Exception
This method is intend to validation the input locale and return data required for running service .