ContainerBag.php 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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;
  18. public function __construct(Container $container)
  19. {
  20. $this->container = $container;
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function all()
  26. {
  27. return $this->container->getParameterBag()->all();
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function get($name)
  33. {
  34. return $this->container->getParameter($name);
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function has($name)
  40. {
  41. return $this->container->hasParameter($name);
  42. }
  43. }