Drupal investigation

FrozenParameterBag.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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\Exception\LogicException;
  12. /**
  13. * Holds read-only parameters.
  14. *
  15. * @author Fabien Potencier <fabien@symfony.com>
  16. */
  17. class FrozenParameterBag extends ParameterBag
  18. {
  19. /**
  20. * For performance reasons, the constructor assumes that
  21. * all keys are already lowercased.
  22. *
  23. * This is always the case when used internally.
  24. *
  25. * @param array $parameters An array of parameters
  26. */
  27. public function __construct(array $parameters = array())
  28. {
  29. $this->parameters = $parameters;
  30. $this->resolved = true;
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function clear()
  36. {
  37. throw new LogicException('Impossible to call clear() on a frozen ParameterBag.');
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function add(array $parameters)
  43. {
  44. throw new LogicException('Impossible to call add() on a frozen ParameterBag.');
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function set($name, $value)
  50. {
  51. throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function remove($name)
  57. {
  58. throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
  59. }
  60. }