ParameterBagInterface.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
  13. /**
  14. * ParameterBagInterface.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. interface ParameterBagInterface
  19. {
  20. /**
  21. * Clears all parameters.
  22. *
  23. * @throws LogicException if the ParameterBagInterface can not be cleared
  24. */
  25. public function clear();
  26. /**
  27. * Adds parameters to the service container parameters.
  28. *
  29. * @param array $parameters An array of parameters
  30. *
  31. * @throws LogicException if the parameter can not be added
  32. */
  33. public function add(array $parameters);
  34. /**
  35. * Gets the service container parameters.
  36. *
  37. * @return array An array of parameters
  38. */
  39. public function all();
  40. /**
  41. * Gets a service container parameter.
  42. *
  43. * @param string $name The parameter name
  44. *
  45. * @return mixed The parameter value
  46. *
  47. * @throws ParameterNotFoundException if the parameter is not defined
  48. */
  49. public function get($name);
  50. /**
  51. * Sets a service container parameter.
  52. *
  53. * @param string $name The parameter name
  54. * @param mixed $value The parameter value
  55. *
  56. * @throws LogicException if the parameter can not be set
  57. */
  58. public function set($name, $value);
  59. /**
  60. * Returns true if a parameter name is defined.
  61. *
  62. * @param string $name The parameter name
  63. *
  64. * @return bool true if the parameter name is defined, false otherwise
  65. */
  66. public function has($name);
  67. /**
  68. * Replaces parameter placeholders (%name%) by their values for all parameters.
  69. */
  70. public function resolve();
  71. /**
  72. * Replaces parameter placeholders (%name%) by their values.
  73. *
  74. * @param mixed $value A value
  75. *
  76. * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
  77. */
  78. public function resolveValue($value);
  79. /**
  80. * Escape parameter placeholders %.
  81. *
  82. * @param mixed $value
  83. *
  84. * @return mixed
  85. */
  86. public function escapeValue($value);
  87. /**
  88. * Unescape parameter placeholders %.
  89. *
  90. * @param mixed $value
  91. *
  92. * @return mixed
  93. */
  94. public function unescapeValue($value);
  95. }