vendor/symfony/dependency-injection/ParameterBag/ContainerBag.php line 39

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\Component\DependencyInjection\ParameterBag;
  11. use Symfony\Component\DependencyInjection\Container;
  12. /**
  13.  * @author Nicolas Grekas <p@tchwork.com>
  14.  */
  15. class ContainerBag extends FrozenParameterBag implements ContainerBagInterface
  16. {
  17.     private Container $container;
  18.     public function __construct(Container $container)
  19.     {
  20.         $this->container $container;
  21.     }
  22.     /**
  23.      * {@inheritdoc}
  24.      */
  25.     public function all(): array
  26.     {
  27.         return $this->container->getParameterBag()->all();
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     public function get(string $name): array|bool|string|int|float|\UnitEnum|null
  33.     {
  34.         return $this->container->getParameter($name);
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function has(string $name): bool
  40.     {
  41.         return $this->container->hasParameter($name);
  42.     }
  43. }