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@0: /** Chris@0: * Reference represents a service reference. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: class Reference Chris@0: { Chris@0: private $id; Chris@0: private $invalidBehavior; Chris@0: 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: * @see Container Chris@0: */ Chris@0: public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) Chris@0: { Chris@14: $this->id = (string) $id; Chris@0: $this->invalidBehavior = $invalidBehavior; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @return string The service identifier Chris@0: */ Chris@0: public function __toString() Chris@0: { Chris@0: return $this->id; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the behavior to be used when the service does not exist. Chris@0: * Chris@0: * @return int Chris@0: */ Chris@0: public function getInvalidBehavior() Chris@0: { Chris@0: return $this->invalidBehavior; Chris@0: } Chris@0: }