"Fossies" - the Fresh Open Source Software Archive

Member "contao-4.4.48/core-bundle/src/DependencyInjection/Compiler/AddSessionBagsPass.php" (2 Apr 2020, 954 Bytes) of package /linux/www/contao-4.4.48.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AddSessionBagsPass.php" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 4.8.8_vs_4.9.0.

    1 <?php
    2 
    3 /*
    4  * This file is part of Contao.
    5  *
    6  * (c) Leo Feyer
    7  *
    8  * @license LGPL-3.0-or-later
    9  */
   10 
   11 namespace Contao\CoreBundle\DependencyInjection\Compiler;
   12 
   13 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
   14 use Symfony\Component\DependencyInjection\ContainerBuilder;
   15 use Symfony\Component\DependencyInjection\Reference;
   16 
   17 /**
   18  * Registers the Contao session bags.
   19  *
   20  * @author Leo Feyer <https://github.com/leofeyer>
   21  */
   22 class AddSessionBagsPass implements CompilerPassInterface
   23 {
   24     /**
   25      * {@inheritdoc}
   26      */
   27     public function process(ContainerBuilder $container)
   28     {
   29         if (!$container->hasDefinition('session')) {
   30             return;
   31         }
   32 
   33         $session = $container->findDefinition('session');
   34         $session->addMethodCall('registerBag', [new Reference('contao.session.contao_backend')]);
   35         $session->addMethodCall('registerBag', [new Reference('contao.session.contao_frontend')]);
   36     }
   37 }