Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / dependency-injection / Loader / Configurator / ReferenceConfigurator.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13
14 use Symfony\Component\DependencyInjection\ContainerInterface;
15
16 /**
17  * @author Nicolas Grekas <p@tchwork.com>
18  */
19 class ReferenceConfigurator extends AbstractConfigurator
20 {
21     /** @internal */
22     protected $id;
23
24     /** @internal */
25     protected $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
26
27     public function __construct($id)
28     {
29         $this->id = $id;
30     }
31
32     /**
33      * @return $this
34      */
35     final public function ignoreOnInvalid()
36     {
37         $this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
38
39         return $this;
40     }
41
42     /**
43      * @return $this
44      */
45     final public function nullOnInvalid()
46     {
47         $this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
48
49         return $this;
50     }
51
52     /**
53      * @return $this
54      */
55     final public function ignoreOnUninitialized()
56     {
57         $this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;
58
59         return $this;
60     }
61
62     public function __toString()
63     {
64         return $this->id;
65     }
66 }