DependencyInjection/LswMemcacheExtension.php
protected function loadFirewall(array $config, ContainerBuilder $container)
    {
    	// make sure the pool is specified and it exists
    	$pool = $config['firewall']['pool'];
    	if (null === $pool) {
    		return;
    	}
    	if (!isset($config['pools']) || !isset($config['pools'][$pool])) {
    		throw new \LogicException(sprintf('The pool "%s" does not exist! Cannot enable the firewall!', $pool));
    	}
    	// calculate options
    	$options = array();
    	$options['prefix'] = $config['firewall']['prefix'];
    	$options['concurrency']    = $config['firewall']['concurrency'];
    	$options['spin_lock_wait'] = $config['firewall']['spin_lock_wait'];
    	$options['lock_max_wait']  = $config['firewall']['lock_max_wait'];
    	$options['reverse_proxies']  = $config['firewall']['reverse_proxies'];
    	$options['x_forwarded_for']  = $config['firewall']['x_forwarded_for'];
    	// load the firewall handler
    	$definition = new Definition($container->getParameter('memcache.firewall_handler.class'));
    	$container->setDefinition('memcache.firewall_handler', $definition);
    	$definition
    	    ->addArgument(new Reference(sprintf('memcache.%s', $pool)))
    	    ->addArgument($options);
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.request','method'=>'onKernelRequest'));
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.terminate','method'=>'onKernelTerminate'));
    	$this->addClassesToCompile(array($definition->getClass()));
    }
protected function loadFirewall(array $config, ContainerBuilder $container)
    {
    	// make sure the pool is specified and it exists
    	$pool = $config['firewall']['pool'];
    	if (null === $pool) {
    		return;
    	}
    	if (!isset($config['pools']) || !isset($config['pools'][$pool])) {
    		throw new \LogicException(sprintf('The pool "%s" does not exist! Cannot enable the firewall!', $pool));
    	}
    	// calculate options
    	$options = array();
    	$options['prefix'] = $config['firewall']['prefix'];
    	$options['concurrency']    = $config['firewall']['concurrency'];
    	$options['spin_lock_wait'] = $config['firewall']['spin_lock_wait'];
    	$options['lock_max_wait']  = $config['firewall']['lock_max_wait'];
    	$options['reverse_proxies']  = $config['firewall']['reverse_proxies'];
    	$options['x_forwarded_for']  = $config['firewall']['x_forwarded_for'];
    	// load the firewall handler
    	$definition = new Definition($container->getParameter('memcache.firewall_handler.class'));
    	$container->setDefinition('memcache.firewall_handler', $definition);
    	$definition
    	    ->addArgument(new Reference(sprintf('memcache.%s', $pool)))
    	    ->addArgument($options);
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.request','method'=>'onKernelRequest'));
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.terminate','method'=>'onKernelTerminate'));
    	$this->addClassesToCompile(array($definition->getClass()));
    }
protected function loadFirewall ( array $ config , ContainerBuilder $ container ) { // make sure the pool is specified and it exists $ pool = $ config [ 'firewall' ] [ 'pool' ] ; if ( null === $ pool ) { return ; } if ( ! isset ( $ config [ 'pools' ] ) || ! isset ( $ config [ 'pools' ] [ $ pool ] ) ) { throw new \ LogicException ( sprintf ( 'The pool "%s" does not exist! Cannot enable the firewall!' , $ pool ) ) ; } // calculate options $ options = array ( ) ; $ options [ 'prefix' ] = $ config [ 'firewall' ] [ 'prefix' ] ; $ options [ 'concurrency' ] = $ config [ 'firewall' ] [ 'concurrency' ] ; $ options [ 'spin_lock_wait' ] = $ config [ 'firewall' ] [ 'spin_lock_wait' ] ; $ options [ 'lock_max_wait' ] = $ config [ 'firewall' ] [ 'lock_max_wait' ] ; $ options [ 'reverse_proxies' ] = $ config [ 'firewall' ] [ 'reverse_proxies' ] ; $ options [ 'x_forwarded_for' ] = $ config [ 'firewall' ] [ 'x_forwarded_for' ] ; // load the firewall handler $ definition = new Definition ( $ container -> getParameter ( 'memcache.firewall_handler.class' ) ) ; $ container -> setDefinition ( 'memcache.firewall_handler' , $ definition ) ; $ definition -> addArgument ( new Reference ( sprintf ( 'memcache.%s' , $ pool ) ) ) -> addArgument ( $ options ) ; $ definition -> addTag ( 'kernel.event_listener' , array ( 'event' => 'kernel.request' , 'method' => 'onKernelRequest' ) ) ; $ definition -> addTag ( 'kernel.event_listener' , array ( 'event' => 'kernel.terminate' , 'method' => 'onKernelTerminate' ) ) ; $ this -> addClassesToCompile ( array ( $ definition -> getClass ( ) ) ) ; }
Loads the Firewall configuration.

@param array $config A configuration array
@param ContainerBuilder $container A ContainerBuilder instance
Loads the Firewall configuration .