* it themselves which improves performance quite a lot.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ *
+ * @final since version 3.4
*/
class ServiceReferenceGraph
{
*/
public function clear()
{
+ foreach ($this->nodes as $node) {
+ $node->clear();
+ }
$this->nodes = array();
}
* Connects 2 nodes together in the Graph.
*
* @param string $sourceId
- * @param string $sourceValue
+ * @param mixed $sourceValue
* @param string $destId
- * @param string $destValue
+ * @param mixed $destValue
* @param string $reference
+ * @param bool $lazy
+ * @param bool $weak
*/
- public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null)
+ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false*/)
{
+ $lazy = func_num_args() >= 6 ? func_get_arg(5) : false;
+ $weak = func_num_args() >= 7 ? func_get_arg(6) : false;
+
+ if (null === $sourceId || null === $destId) {
+ return;
+ }
+
$sourceNode = $this->createNode($sourceId, $sourceValue);
$destNode = $this->createNode($destId, $destValue);
- $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference);
+ $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak);
$sourceNode->addOutEdge($edge);
$destNode->addInEdge($edge);
* Creates a graph node.
*
* @param string $id
- * @param string $value
+ * @param mixed $value
*
* @return ServiceReferenceGraphNode
*/