Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/graph/PhabricatorObjectGraph.php
| <?php | <?php | ||||
| abstract class PhabricatorObjectGraph | abstract class PhabricatorObjectGraph | ||||
| extends AbstractDirectedGraph { | extends AbstractDirectedGraph { | ||||
| private $viewer; | private $viewer; | ||||
| private $edges = array(); | private $edges = array(); | ||||
| private $edgeReach = array(); | private $edgeReach = array(); | ||||
| private $seedPHID; | private $seedPHID; | ||||
| private $objects; | private $objects; | ||||
| private $loadEntireGraph = false; | private $loadEntireGraph = false; | ||||
| private $limit; | private $limit; | ||||
| private $adjacent; | private $adjacent; | ||||
| private $height; | |||||
| public function setViewer(PhabricatorUser $viewer) { | public function setViewer(PhabricatorUser $viewer) { | ||||
| $this->viewer = $viewer; | $this->viewer = $viewer; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getViewer() { | public function getViewer() { | ||||
| if (!$this->viewer) { | if (!$this->viewer) { | ||||
| throw new PhutilInvalidStateException('setViewer'); | throw new PhutilInvalidStateException('setViewer'); | ||||
| } | } | ||||
| return $this->viewer; | return $this->viewer; | ||||
| } | } | ||||
| public function setLimit($limit) { | public function setLimit($limit) { | ||||
| $this->limit = $limit; | $this->limit = $limit; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getLimit() { | public function getLimit() { | ||||
| return $this->limit; | return $this->limit; | ||||
| } | } | ||||
| public function setHeight($height) { | |||||
| $this->height = $height; | |||||
| return $this; | |||||
| } | |||||
| public function getHeight() { | |||||
| return $this->height; | |||||
| } | |||||
| final public function setRenderOnlyAdjacentNodes($adjacent) { | final public function setRenderOnlyAdjacentNodes($adjacent) { | ||||
| $this->adjacent = $adjacent; | $this->adjacent = $adjacent; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final public function getRenderOnlyAdjacentNodes() { | final public function getRenderOnlyAdjacentNodes() { | ||||
| return $this->adjacent; | return $this->adjacent; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | final public function newGraphTable() { | ||||
| $objects = mpull($objects, null, 'getPHID'); | $objects = mpull($objects, null, 'getPHID'); | ||||
| $order = id(new PhutilDirectedScalarGraph()) | $order = id(new PhutilDirectedScalarGraph()) | ||||
| ->addNodes($ancestry) | ->addNodes($ancestry) | ||||
| ->getNodesInTopologicalOrder(); | ->getNodesInTopologicalOrder(); | ||||
| $ancestry = array_select_keys($ancestry, $order); | $ancestry = array_select_keys($ancestry, $order); | ||||
| $traces = id(new PHUIDiffGraphView()) | $graph_view = id(new PHUIDiffGraphView()); | ||||
| ->renderGraph($ancestry); | |||||
| $height = $this->getHeight(); | |||||
| if ($height !== null) { | |||||
| $graph_view->setHeight($height); | |||||
| } | |||||
| $traces = $graph_view->renderGraph($ancestry); | |||||
| $ii = 0; | $ii = 0; | ||||
| $rows = array(); | $rows = array(); | ||||
| $rowc = array(); | $rowc = array(); | ||||
| if ($only_adjacent) { | if ($only_adjacent) { | ||||
| $rows[] = $this->newEllipsisRow(); | $rows[] = $this->newEllipsisRow(); | ||||
| $rowc[] = 'more'; | $rowc[] = 'more'; | ||||
| ▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines | |||||