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
27 private $inEdges = array();
28 private $outEdges = array();
32 * @param string $id The node identifier
33 * @param mixed $value The node value
35 public function __construct($id, $value)
38 $this->value = $value;
42 * Adds an in edge to this node.
44 * @param ServiceReferenceGraphEdge $edge
46 public function addInEdge(ServiceReferenceGraphEdge $edge)
48 $this->inEdges[] = $edge;
52 * Adds an out edge to this node.
54 * @param ServiceReferenceGraphEdge $edge
56 public function addOutEdge(ServiceReferenceGraphEdge $edge)
58 $this->outEdges[] = $edge;
62 * Checks if the value of this node is an Alias.
64 * @return bool True if the value is an Alias instance
66 public function isAlias()
68 return $this->value instanceof Alias;
72 * Checks if the value of this node is a Definition.
74 * @return bool True if the value is a Definition instance
76 public function isDefinition()
78 return $this->value instanceof Definition;
82 * Returns the identifier.
86 public function getId()
92 * Returns the in edges.
94 * @return array The in ServiceReferenceGraphEdge array
96 public function getInEdges()
98 return $this->inEdges;
102 * Returns the out edges.
104 * @return array The out ServiceReferenceGraphEdge array
106 public function getOutEdges()
108 return $this->outEdges;
112 * Returns the value of this Node.
114 * @return mixed The value
116 public function getValue()