Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
18 * | 18 * |
19 * This information can be used by your compiler passes instead of collecting | 19 * This information can be used by your compiler passes instead of collecting |
20 * it themselves which improves performance quite a lot. | 20 * it themselves which improves performance quite a lot. |
21 * | 21 * |
22 * @author Johannes M. Schmitt <schmittjoh@gmail.com> | 22 * @author Johannes M. Schmitt <schmittjoh@gmail.com> |
23 * | |
24 * @final since version 3.4 | |
23 */ | 25 */ |
24 class ServiceReferenceGraph | 26 class ServiceReferenceGraph |
25 { | 27 { |
26 /** | 28 /** |
27 * @var ServiceReferenceGraphNode[] | 29 * @var ServiceReferenceGraphNode[] |
71 /** | 73 /** |
72 * Clears all nodes. | 74 * Clears all nodes. |
73 */ | 75 */ |
74 public function clear() | 76 public function clear() |
75 { | 77 { |
78 foreach ($this->nodes as $node) { | |
79 $node->clear(); | |
80 } | |
76 $this->nodes = array(); | 81 $this->nodes = array(); |
77 } | 82 } |
78 | 83 |
79 /** | 84 /** |
80 * Connects 2 nodes together in the Graph. | 85 * Connects 2 nodes together in the Graph. |
81 * | 86 * |
82 * @param string $sourceId | 87 * @param string $sourceId |
83 * @param string $sourceValue | 88 * @param mixed $sourceValue |
84 * @param string $destId | 89 * @param string $destId |
85 * @param string $destValue | 90 * @param mixed $destValue |
86 * @param string $reference | 91 * @param string $reference |
92 * @param bool $lazy | |
93 * @param bool $weak | |
87 */ | 94 */ |
88 public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null) | 95 public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false*/) |
89 { | 96 { |
97 $lazy = func_num_args() >= 6 ? func_get_arg(5) : false; | |
98 $weak = func_num_args() >= 7 ? func_get_arg(6) : false; | |
99 | |
100 if (null === $sourceId || null === $destId) { | |
101 return; | |
102 } | |
103 | |
90 $sourceNode = $this->createNode($sourceId, $sourceValue); | 104 $sourceNode = $this->createNode($sourceId, $sourceValue); |
91 $destNode = $this->createNode($destId, $destValue); | 105 $destNode = $this->createNode($destId, $destValue); |
92 $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference); | 106 $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak); |
93 | 107 |
94 $sourceNode->addOutEdge($edge); | 108 $sourceNode->addOutEdge($edge); |
95 $destNode->addInEdge($edge); | 109 $destNode->addInEdge($edge); |
96 } | 110 } |
97 | 111 |
98 /** | 112 /** |
99 * Creates a graph node. | 113 * Creates a graph node. |
100 * | 114 * |
101 * @param string $id | 115 * @param string $id |
102 * @param string $value | 116 * @param mixed $value |
103 * | 117 * |
104 * @return ServiceReferenceGraphNode | 118 * @return ServiceReferenceGraphNode |
105 */ | 119 */ |
106 private function createNode($id, $value) | 120 private function createNode($id, $value) |
107 { | 121 { |