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;
26 * Note: The $strict parameter is deprecated since version 2.8 and will be removed in 3.0.
28 * @param string $id The service identifier
29 * @param int $invalidBehavior The behavior when the service does not exist
30 * @param bool $strict Sets how this reference is validated
34 public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $strict = true)
36 $this->id = strtolower($id);
37 $this->invalidBehavior = $invalidBehavior;
38 $this->strict = $strict;
42 * @return string The service identifier
44 public function __toString()
50 * Returns the behavior to be used when the service does not exist.
54 public function getInvalidBehavior()
56 return $this->invalidBehavior;
60 * Returns true when this Reference is strict.
64 * @deprecated since version 2.8, to be removed in 3.0.
66 public function isStrict($triggerDeprecationError = true)
68 if ($triggerDeprecationError) {
69 @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);