commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / vendor / symfony / dependency-injection / Symfony / Component / DependencyInjection / 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;
28 private $outEdges;
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 $this->inEdges = array();
40 $this->outEdges = array();
41 }
42
43 /**
44 * Adds an in edge to this node.
45 *
46 * @param ServiceReferenceGraphEdge $edge
47 */
48 public function addInEdge(ServiceReferenceGraphEdge $edge)
49 {
50 $this->inEdges[] = $edge;
51 }
52
53 /**
54 * Adds an out edge to this node.
55 *
56 * @param ServiceReferenceGraphEdge $edge
57 */
58 public function addOutEdge(ServiceReferenceGraphEdge $edge)
59 {
60 $this->outEdges[] = $edge;
61 }
62
63 /**
64 * Checks if the value of this node is an Alias.
65 *
66 * @return bool True if the value is an Alias instance
67 */
68 public function isAlias()
69 {
70 return $this->value instanceof Alias;
71 }
72
73 /**
74 * Checks if the value of this node is a Definition.
75 *
76 * @return bool True if the value is a Definition instance
77 */
78 public function isDefinition()
79 {
80 return $this->value instanceof Definition;
81 }
82
83 /**
84 * Returns the identifier.
85 *
86 * @return string
87 */
88 public function getId()
89 {
90 return $this->id;
91 }
92
93 /**
94 * Returns the in edges.
95 *
96 * @return array The in ServiceReferenceGraphEdge array
97 */
98 public function getInEdges()
99 {
100 return $this->inEdges;
101 }
102
103 /**
104 * Returns the out edges.
105 *
106 * @return array The out ServiceReferenceGraphEdge array
107 */
108 public function getOutEdges()
109 {
110 return $this->outEdges;
111 }
112
113 /**
114 * Returns the value of this Node.
115 *
116 * @return mixed The value
117 */
118 public function getValue()
119 {
120 return $this->value;
121 }
122 }