[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/edges/util/ -> PhabricatorEdgeGraph.php (source)

   1  <?php
   2  
   3  final class PhabricatorEdgeGraph extends AbstractDirectedGraph {
   4  
   5    private $edgeType;
   6  
   7    public function setEdgeType($edge_type) {
   8      $this->edgeType = $edge_type;
   9      return $this;
  10    }
  11  
  12    protected function loadEdges(array $nodes) {
  13      if (!$this->edgeType) {
  14        throw new Exception('Set edge type before loading graph!');
  15      }
  16  
  17      $edges = id(new PhabricatorEdgeQuery())
  18        ->withSourcePHIDs($nodes)
  19        ->withEdgeTypes(array($this->edgeType))
  20        ->execute();
  21  
  22      $results = array_fill_keys($nodes, array());
  23      foreach ($edges as $src => $types) {
  24        foreach ($types as $type => $dsts) {
  25          foreach ($dsts as $dst => $edge) {
  26            $results[$src][] = $dst;
  27          }
  28        }
  29      }
  30  
  31      return $results;
  32    }
  33  
  34  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1