vendor/symfony/framework-bundle/Routing/LegacyRouteLoaderContainer.php line 41

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\FrameworkBundle\Routing;
  11. use Psr\Container\ContainerInterface;
  12. /**
  13.  * @internal to be removed in Symfony 5.0
  14.  */
  15. class LegacyRouteLoaderContainer implements ContainerInterface
  16. {
  17.     private $container;
  18.     private $serviceLocator;
  19.     public function __construct(ContainerInterface $containerContainerInterface $serviceLocator)
  20.     {
  21.         $this->container $container;
  22.         $this->serviceLocator $serviceLocator;
  23.     }
  24.     /**
  25.      * {@inheritdoc}
  26.      *
  27.      * @return mixed
  28.      */
  29.     public function get($id)
  30.     {
  31.         if ($this->serviceLocator->has($id)) {
  32.             return $this->serviceLocator->get($id);
  33.         }
  34.         @trigger_error(sprintf('Registering the service route loader "%s" without tagging it with the "routing.route_loader" tag is deprecated since Symfony 4.4 and will be required in Symfony 5.0.'$id), \E_USER_DEPRECATED);
  35.         return $this->container->get($id);
  36.     }
  37.     /**
  38.      * {@inheritdoc}
  39.      *
  40.      * @return bool
  41.      */
  42.     public function has($id)
  43.     {
  44.         return $this->serviceLocator->has($id) || $this->container->has($id);
  45.     }
  46. }