Drupal investigation

ContainerInterface.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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;
  11. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  12. use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
  13. use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
  14. /**
  15. * ContainerInterface is the interface implemented by service container classes.
  16. *
  17. * @author Fabien Potencier <fabien@symfony.com>
  18. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  19. */
  20. interface ContainerInterface
  21. {
  22. const EXCEPTION_ON_INVALID_REFERENCE = 1;
  23. const NULL_ON_INVALID_REFERENCE = 2;
  24. const IGNORE_ON_INVALID_REFERENCE = 3;
  25. const SCOPE_CONTAINER = 'container';
  26. const SCOPE_PROTOTYPE = 'prototype';
  27. /**
  28. * Sets a service.
  29. *
  30. * Note: The $scope parameter is deprecated since version 2.8 and will be removed in 3.0.
  31. *
  32. * @param string $id The service identifier
  33. * @param object $service The service instance
  34. * @param string $scope The scope of the service
  35. */
  36. public function set($id, $service, $scope = self::SCOPE_CONTAINER);
  37. /**
  38. * Gets a service.
  39. *
  40. * @param string $id The service identifier
  41. * @param int $invalidBehavior The behavior when the service does not exist
  42. *
  43. * @return object The associated service
  44. *
  45. * @throws ServiceCircularReferenceException When a circular reference is detected
  46. * @throws ServiceNotFoundException When the service is not defined
  47. *
  48. * @see Reference
  49. */
  50. public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
  51. /**
  52. * Returns true if the given service is defined.
  53. *
  54. * @param string $id The service identifier
  55. *
  56. * @return bool true if the service is defined, false otherwise
  57. */
  58. public function has($id);
  59. /**
  60. * Gets a parameter.
  61. *
  62. * @param string $name The parameter name
  63. *
  64. * @return mixed The parameter value
  65. *
  66. * @throws InvalidArgumentException if the parameter is not defined
  67. */
  68. public function getParameter($name);
  69. /**
  70. * Checks if a parameter exists.
  71. *
  72. * @param string $name The parameter name
  73. *
  74. * @return bool The presence of parameter in container
  75. */
  76. public function hasParameter($name);
  77. /**
  78. * Sets a parameter.
  79. *
  80. * @param string $name The parameter name
  81. * @param mixed $value The parameter value
  82. */
  83. public function setParameter($name, $value);
  84. /**
  85. * Enters the given scope.
  86. *
  87. * @param string $name
  88. *
  89. * @deprecated since version 2.8, to be removed in 3.0.
  90. */
  91. public function enterScope($name);
  92. /**
  93. * Leaves the current scope, and re-enters the parent scope.
  94. *
  95. * @param string $name
  96. *
  97. * @deprecated since version 2.8, to be removed in 3.0.
  98. */
  99. public function leaveScope($name);
  100. /**
  101. * Adds a scope to the container.
  102. *
  103. * @param ScopeInterface $scope
  104. *
  105. * @deprecated since version 2.8, to be removed in 3.0.
  106. */
  107. public function addScope(ScopeInterface $scope);
  108. /**
  109. * Whether this container has the given scope.
  110. *
  111. * @param string $name
  112. *
  113. * @return bool
  114. *
  115. * @deprecated since version 2.8, to be removed in 3.0.
  116. */
  117. public function hasScope($name);
  118. /**
  119. * Determines whether the given scope is currently active.
  120. *
  121. * It does however not check if the scope actually exists.
  122. *
  123. * @param string $name
  124. *
  125. * @return bool
  126. *
  127. * @deprecated since version 2.8, to be removed in 3.0.
  128. */
  129. public function isScopeActive($name);
  130. }