Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / dependency-injection / Compiler / ServiceReferenceGraphNode.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\Compiler;
13
14 use Symfony\Component\DependencyInjection\Definition;
15 use Symfony\Component\DependencyInjection\Alias;
16
17 /**
18  * Represents a node in your service graph.
19  *
20  * Value is typically a definition, or an alias.
21  *
22  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
23  */
24 class ServiceReferenceGraphNode
25 {
26     private $id;
27     private $inEdges = array();
28     private $outEdges = array();
29     private $value;
30
31     /**
32      * @param string $id    The node identifier
33      * @param mixed  $value The node value
34      */
35     public function __construct($id, $value)
36     {
37         $this->id = $id;
38         $this->value = $value;
39     }
40
41     public function addInEdge(ServiceReferenceGraphEdge $edge)
42     {
43         $this->inEdges[] = $edge;
44     }
45
46     public function addOutEdge(ServiceReferenceGraphEdge $edge)
47     {
48         $this->outEdges[] = $edge;
49     }
50
51     /**
52      * Checks if the value of this node is an Alias.
53      *
54      * @return bool True if the value is an Alias instance
55      */
56     public function isAlias()
57     {
58         return $this->value instanceof Alias;
59     }
60
61     /**
62      * Checks if the value of this node is a Definition.
63      *
64      * @return bool True if the value is a Definition instance
65      */
66     public function isDefinition()
67     {
68         return $this->value instanceof Definition;
69     }
70
71     /**
72      * Returns the identifier.
73      *
74      * @return string
75      */
76     public function getId()
77     {
78         return $this->id;
79     }
80
81     /**
82      * Returns the in edges.
83      *
84      * @return array The in ServiceReferenceGraphEdge array
85      */
86     public function getInEdges()
87     {
88         return $this->inEdges;
89     }
90
91     /**
92      * Returns the out edges.
93      *
94      * @return array The out ServiceReferenceGraphEdge array
95      */
96     public function getOutEdges()
97     {
98         return $this->outEdges;
99     }
100
101     /**
102      * Returns the value of this Node.
103      *
104      * @return mixed The value
105      */
106     public function getValue()
107     {
108         return $this->value;
109     }
110
111     /**
112      * Clears all edges.
113      */
114     public function clear()
115     {
116         $this->inEdges = $this->outEdges = array();
117     }
118 }