Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DependencyInjection; Chris@0: Chris@14: use Psr\Container\ContainerInterface as PsrContainerInterface; Chris@0: use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; Chris@0: use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; Chris@0: use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; Chris@0: Chris@0: /** Chris@0: * ContainerInterface is the interface implemented by service container classes. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: * @author Johannes M. Schmitt Chris@0: */ Chris@14: interface ContainerInterface extends PsrContainerInterface Chris@0: { Chris@0: const EXCEPTION_ON_INVALID_REFERENCE = 1; Chris@0: const NULL_ON_INVALID_REFERENCE = 2; Chris@0: const IGNORE_ON_INVALID_REFERENCE = 3; Chris@14: const IGNORE_ON_UNINITIALIZED_REFERENCE = 4; Chris@0: Chris@0: /** Chris@0: * Sets a service. Chris@0: * Chris@0: * @param string $id The service identifier Chris@0: * @param object $service The service instance Chris@0: */ Chris@0: public function set($id, $service); Chris@0: Chris@0: /** Chris@0: * Gets a service. Chris@0: * Chris@0: * @param string $id The service identifier Chris@0: * @param int $invalidBehavior The behavior when the service does not exist Chris@0: * Chris@0: * @return object The associated service Chris@0: * Chris@0: * @throws ServiceCircularReferenceException When a circular reference is detected Chris@0: * @throws ServiceNotFoundException When the service is not defined Chris@0: * Chris@0: * @see Reference Chris@0: */ Chris@0: public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); Chris@0: Chris@0: /** Chris@0: * Returns true if the given service is defined. Chris@0: * Chris@0: * @param string $id The service identifier Chris@0: * Chris@0: * @return bool true if the service is defined, false otherwise Chris@0: */ Chris@0: public function has($id); Chris@0: Chris@0: /** Chris@0: * Check for whether or not a service has been initialized. Chris@0: * Chris@0: * @param string $id Chris@0: * Chris@0: * @return bool true if the service has been initialized, false otherwise Chris@0: */ Chris@0: public function initialized($id); Chris@0: Chris@0: /** Chris@0: * Gets a parameter. Chris@0: * Chris@0: * @param string $name The parameter name Chris@0: * Chris@0: * @return mixed The parameter value Chris@0: * Chris@0: * @throws InvalidArgumentException if the parameter is not defined Chris@0: */ Chris@0: public function getParameter($name); Chris@0: Chris@0: /** Chris@0: * Checks if a parameter exists. Chris@0: * Chris@0: * @param string $name The parameter name Chris@0: * Chris@0: * @return bool The presence of parameter in container Chris@0: */ Chris@0: public function hasParameter($name); Chris@0: Chris@0: /** Chris@0: * Sets a parameter. Chris@0: * Chris@0: * @param string $name The parameter name Chris@0: * @param mixed $value The parameter value Chris@0: */ Chris@0: public function setParameter($name, $value); Chris@0: }