Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 1fec387a4317 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 /** | |
42 * Adds an in edge to this node. | |
43 * | |
44 * @param ServiceReferenceGraphEdge $edge | |
45 */ | |
46 public function addInEdge(ServiceReferenceGraphEdge $edge) | |
47 { | |
48 $this->inEdges[] = $edge; | |
49 } | |
50 | |
51 /** | |
52 * Adds an out edge to this node. | |
53 * | |
54 * @param ServiceReferenceGraphEdge $edge | |
55 */ | |
56 public function addOutEdge(ServiceReferenceGraphEdge $edge) | |
57 { | |
58 $this->outEdges[] = $edge; | |
59 } | |
60 | |
61 /** | |
62 * Checks if the value of this node is an Alias. | |
63 * | |
64 * @return bool True if the value is an Alias instance | |
65 */ | |
66 public function isAlias() | |
67 { | |
68 return $this->value instanceof Alias; | |
69 } | |
70 | |
71 /** | |
72 * Checks if the value of this node is a Definition. | |
73 * | |
74 * @return bool True if the value is a Definition instance | |
75 */ | |
76 public function isDefinition() | |
77 { | |
78 return $this->value instanceof Definition; | |
79 } | |
80 | |
81 /** | |
82 * Returns the identifier. | |
83 * | |
84 * @return string | |
85 */ | |
86 public function getId() | |
87 { | |
88 return $this->id; | |
89 } | |
90 | |
91 /** | |
92 * Returns the in edges. | |
93 * | |
94 * @return array The in ServiceReferenceGraphEdge array | |
95 */ | |
96 public function getInEdges() | |
97 { | |
98 return $this->inEdges; | |
99 } | |
100 | |
101 /** | |
102 * Returns the out edges. | |
103 * | |
104 * @return array The out ServiceReferenceGraphEdge array | |
105 */ | |
106 public function getOutEdges() | |
107 { | |
108 return $this->outEdges; | |
109 } | |
110 | |
111 /** | |
112 * Returns the value of this Node. | |
113 * | |
114 * @return mixed The value | |
115 */ | |
116 public function getValue() | |
117 { | |
118 return $this->value; | |
119 } | |
120 } |