4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection;
15 * Reference represents a service reference.
17 * @author Fabien Potencier <fabien@symfony.com>
22 private $invalidBehavior;
25 * @param string $id The service identifier
26 * @param int $invalidBehavior The behavior when the service does not exist
30 public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
32 $this->id = (string) $id;
33 $this->invalidBehavior = $invalidBehavior;
37 * @return string The service identifier
39 public function __toString()
45 * Returns the behavior to be used when the service does not exist.
49 public function getInvalidBehavior()
51 return $this->invalidBehavior;