2011-11-22 20:36:57 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class CelerityResourceGraph extends AbstractDirectedGraph {
|
|
|
|
|
|
|
|
private $resourceGraph = array();
|
|
|
|
private $graphSet = false;
|
|
|
|
|
|
|
|
protected function loadEdges(array $nodes) {
|
|
|
|
if (!$this->graphSet) {
|
2015-05-13 23:53:52 +02:00
|
|
|
throw new PhutilInvalidStateException('setResourceGraph');
|
2011-11-22 20:36:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$graph = $this->getResourceGraph();
|
|
|
|
$edges = array();
|
|
|
|
foreach ($nodes as $node) {
|
|
|
|
$edges[$node] = idx($graph, $node, array());
|
|
|
|
}
|
|
|
|
return $edges;
|
|
|
|
}
|
|
|
|
|
2015-05-19 23:06:07 +02:00
|
|
|
public function setResourceGraph(array $graph) {
|
2011-11-22 20:36:57 +01:00
|
|
|
$this->resourceGraph = $graph;
|
|
|
|
$this->graphSet = true;
|
2012-04-03 03:35:09 +02:00
|
|
|
return $this;
|
2011-11-22 20:36:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function getResourceGraph() {
|
|
|
|
return $this->resourceGraph;
|
|
|
|
}
|
|
|
|
}
|