"Fossies" - the Fresh Open Source Software Archive

Member "Symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php" (30 Mar 2020, 2573 Bytes) of package /linux/www/Symfony_Standard_Vendors_3.4.39.tgz:


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 "AbstractController.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 /*
    4  * This file is part of the Symfony package.
    5  *
    6  * (c) Fabien Potencier <fabien@symfony.com>
    7  *
    8  * For the full copyright and license information, please view the LICENSE
    9  * file that was distributed with this source code.
   10  */
   11 
   12 namespace Symfony\Bundle\FrameworkBundle\Controller;
   13 
   14 use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
   15 use Doctrine\Persistence\ManagerRegistry;
   16 use Psr\Container\ContainerInterface;
   17 use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
   18 use Symfony\Component\Form\FormFactoryInterface;
   19 use Symfony\Component\HttpFoundation\RequestStack;
   20 use Symfony\Component\HttpFoundation\Session\SessionInterface;
   21 use Symfony\Component\HttpKernel\HttpKernelInterface;
   22 use Symfony\Component\Routing\RouterInterface;
   23 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
   24 use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
   25 use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
   26 use Symfony\Component\Serializer\SerializerInterface;
   27 use Symfony\Component\Templating\EngineInterface;
   28 use Twig\Environment;
   29 
   30 /**
   31  * Provides common features needed in controllers.
   32  *
   33  * @author Fabien Potencier <fabien@symfony.com>
   34  */
   35 abstract class AbstractController implements ServiceSubscriberInterface
   36 {
   37     use ControllerTrait;
   38 
   39     /**
   40      * @var ContainerInterface
   41      */
   42     protected $container;
   43 
   44     /**
   45      * @internal
   46      * @required
   47      */
   48     public function setContainer(ContainerInterface $container)
   49     {
   50         $previous = $this->container;
   51         $this->container = $container;
   52 
   53         return $previous;
   54     }
   55 
   56     public static function getSubscribedServices()
   57     {
   58         return [
   59             'router' => '?'.RouterInterface::class,
   60             'request_stack' => '?'.RequestStack::class,
   61             'http_kernel' => '?'.HttpKernelInterface::class,
   62             'serializer' => '?'.SerializerInterface::class,
   63             'session' => '?'.SessionInterface::class,
   64             'security.authorization_checker' => '?'.AuthorizationCheckerInterface::class,
   65             'templating' => '?'.EngineInterface::class,
   66             'twig' => '?'.Environment::class,
   67             'doctrine' => '?'.(interface_exists(ManagerRegistry::class) ? ManagerRegistry::class : LegacyManagerRegistry::class),
   68             'form.factory' => '?'.FormFactoryInterface::class,
   69             'security.token_storage' => '?'.TokenStorageInterface::class,
   70             'security.csrf.token_manager' => '?'.CsrfTokenManagerInterface::class,
   71         ];
   72     }
   73 }