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\Compiler
;
14 use Symfony\Component\DependencyInjection\Definition
;
15 use Symfony\Component\DependencyInjection\Alias
;
18 * Represents a node in your service graph.
20 * Value is typically a definition, or an alias.
22 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
24 class ServiceReferenceGraphNode
32 * @param string $id The node identifier
33 * @param mixed $value The node value
35 public function __construct($id, $value)
38 $this->value
= $value;
39 $this->inEdges
= array();
40 $this->outEdges
= array();
44 * Adds an in edge to this node.
46 * @param ServiceReferenceGraphEdge $edge
48 public function addInEdge(ServiceReferenceGraphEdge
$edge)
50 $this->inEdges
[] = $edge;
54 * Adds an out edge to this node.
56 * @param ServiceReferenceGraphEdge $edge
58 public function addOutEdge(ServiceReferenceGraphEdge
$edge)
60 $this->outEdges
[] = $edge;
64 * Checks if the value of this node is an Alias.
66 * @return bool True if the value is an Alias instance
68 public function isAlias()
70 return $this->value
instanceof Alias
;
74 * Checks if the value of this node is a Definition.
76 * @return bool True if the value is a Definition instance
78 public function isDefinition()
80 return $this->value
instanceof Definition
;
84 * Returns the identifier.
88 public function getId()
94 * Returns the in edges.
96 * @return array The in ServiceReferenceGraphEdge array
98 public function getInEdges()
100 return $this->inEdges
;
104 * Returns the out edges.
106 * @return array The out ServiceReferenceGraphEdge array
108 public function getOutEdges()
110 return $this->outEdges
;
114 * Returns the value of this Node.
116 * @return mixed The value
118 public function getValue()