composer package updates
[openemr.git] / vendor / symfony / dependency-injection / Reference.php
blob869dfae1bc029d41a0b8e0fc684c26c2faaab400
1 <?php
3 /*
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;
14 /**
15 * Reference represents a service reference.
17 * @author Fabien Potencier <fabien@symfony.com>
19 class Reference
21 private $id;
22 private $invalidBehavior;
23 private $strict;
25 /**
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
32 * @see Container
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;
41 /**
42 * @return string The service identifier
44 public function __toString()
46 return $this->id;
49 /**
50 * Returns the behavior to be used when the service does not exist.
52 * @return int
54 public function getInvalidBehavior()
56 return $this->invalidBehavior;
59 /**
60 * Returns true when this Reference is strict.
62 * @return bool
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 Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
72 return $this->strict;