Path: blob/master/src/infrastructure/edges/util/PhabricatorEdgeGraph.php
13422 views
<?php12final class PhabricatorEdgeGraph extends AbstractDirectedGraph {34private $edgeType;56public function setEdgeType($edge_type) {7$this->edgeType = $edge_type;8return $this;9}1011protected function loadEdges(array $nodes) {12if (!$this->edgeType) {13throw new Exception(pht('Set edge type before loading graph!'));14}1516$edges = id(new PhabricatorEdgeQuery())17->withSourcePHIDs($nodes)18->withEdgeTypes(array($this->edgeType))19->execute();2021$results = array_fill_keys($nodes, array());22foreach ($edges as $src => $types) {23foreach ($types as $type => $dsts) {24foreach ($dsts as $dst => $edge) {25$results[$src][] = $dst;26}27}28}2930return $results;31}3233}343536