Symfony\Component\DependencyInjection\ContainerInterface::getParameter PHP Method

getParameter() public method

Gets a parameter.
public getParameter ( string $name ) : mixed
$name string The parameter name
return mixed The parameter value
    function getParameter($name);

Usage Example

 /**
  * Invoked to modify the controller that should be executed.
  *
  * @param GetResponseEvent $event The event
  * 
  * @access public
  * @return null|void
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // ne rien faire si ce n'est pas la requĂȘte principale
         return;
     }
     $this->request = $event->getRequest($event);
     //if (!$this->request->hasPreviousSession()) {
     //    return;
     //}
     // print_r('priority 1');
     // we set locale
     $locale = $this->request->cookies->has('_locale');
     $localevalue = $this->request->cookies->get('_locale');
     $is_switch_language_browser_authorized = $this->container->getParameter('sfynx.auth.browser.switch_language_authorized');
     // Sets the user local value.
     if ($is_switch_language_browser_authorized && !$locale) {
         $lang_value = $this->container->get('request')->getPreferredLanguage();
         $all_locales = $this->container->get('sfynx.auth.locale_manager')->getAllLocales();
         if (in_array($lang_value, $all_locales)) {
             $this->request->setLocale($lang_value);
             $_GET['_locale'] = $lang_value;
             return;
         }
     }
     if ($locale && !empty($localevalue)) {
         $this->request->attributes->set('_locale', $localevalue);
         $this->request->setLocale($localevalue);
         $_GET['_locale'] = $localevalue;
     } else {
         $this->request->attributes->set('_locale', $this->defaultLocale);
         $this->request->setLocale($this->defaultLocale);
         $_GET['_locale'] = $this->defaultLocale;
     }
 }
All Usage Examples Of Symfony\Component\DependencyInjection\ContainerInterface::getParameter