ContainerInterface.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 YoastSEO_Vendor\Symfony\Component\DependencyInjection;
  11. use YoastSEO_Vendor\Psr\Container\ContainerInterface as PsrContainerInterface;
  12. use YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  13. use YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
  14. use YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
  15. /**
  16. * ContainerInterface is the interface implemented by service container classes.
  17. *
  18. * @author Fabien Potencier <fabien@symfony.com>
  19. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  20. */
  21. interface ContainerInterface extends \YoastSEO_Vendor\Psr\Container\ContainerInterface
  22. {
  23. const EXCEPTION_ON_INVALID_REFERENCE = 1;
  24. const NULL_ON_INVALID_REFERENCE = 2;
  25. const IGNORE_ON_INVALID_REFERENCE = 3;
  26. const IGNORE_ON_UNINITIALIZED_REFERENCE = 4;
  27. /**
  28. * Sets a service.
  29. *
  30. * @param string $id The service identifier
  31. * @param object $service The service instance
  32. */
  33. public function set($id, $service);
  34. /**
  35. * Gets a service.
  36. *
  37. * @param string $id The service identifier
  38. * @param int $invalidBehavior The behavior when the service does not exist
  39. *
  40. * @return object The associated service
  41. *
  42. * @throws ServiceCircularReferenceException When a circular reference is detected
  43. * @throws ServiceNotFoundException When the service is not defined
  44. *
  45. * @see Reference
  46. */
  47. public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
  48. /**
  49. * Returns true if the given service is defined.
  50. *
  51. * @param string $id The service identifier
  52. *
  53. * @return bool true if the service is defined, false otherwise
  54. */
  55. public function has($id);
  56. /**
  57. * Check for whether or not a service has been initialized.
  58. *
  59. * @param string $id
  60. *
  61. * @return bool true if the service has been initialized, false otherwise
  62. */
  63. public function initialized($id);
  64. /**
  65. * Gets a parameter.
  66. *
  67. * @param string $name The parameter name
  68. *
  69. * @return mixed The parameter value
  70. *
  71. * @throws InvalidArgumentException if the parameter is not defined
  72. */
  73. public function getParameter($name);
  74. /**
  75. * Checks if a parameter exists.
  76. *
  77. * @param string $name The parameter name
  78. *
  79. * @return bool The presence of parameter in container
  80. */
  81. public function hasParameter($name);
  82. /**
  83. * Sets a parameter.
  84. *
  85. * @param string $name The parameter name
  86. * @param mixed $value The parameter value
  87. */
  88. public function setParameter($name, $value);
  89. }