ParameterBagInterface.php 2.4 KB

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