3 final class DiffusionDocumentRenderingEngine
4 extends PhabricatorDocumentRenderingEngine
{
6 private $diffusionRequest;
8 public function setDiffusionRequest(DiffusionRequest
$drequest) {
9 $this->diffusionRequest
= $drequest;
13 public function getDiffusionRequest() {
14 return $this->diffusionRequest
;
17 protected function newRefViewURI(
18 PhabricatorDocumentRef
$ref,
19 PhabricatorDocumentEngine
$engine) {
21 $file = $ref->getFile();
22 $engine_key = $engine->getDocumentEngineKey();
23 $drequest = $this->getDiffusionRequest();
25 return (string)$drequest->generateURI(
35 protected function newRefRenderURI(
36 PhabricatorDocumentRef
$ref,
37 PhabricatorDocumentEngine
$engine) {
39 $engine_key = $engine->getDocumentEngineKey();
41 $file = $ref->getFile();
42 $file_phid = $file->getPHID();
44 $drequest = $this->getDiffusionRequest();
46 return (string)$drequest->generateURI(
48 'action' => 'document',
52 'filePHID' => $file_phid,
57 protected function getSelectedDocumentEngineKey() {
58 return $this->getRequest()->getStr('as');
61 protected function getSelectedLineRange() {
62 $range = $this->getDiffusionRequest()->getLine();
63 return AphrontRequest
::parseURILineRange($range, 1000);
66 protected function addApplicationCrumbs(
67 PHUICrumbsView
$crumbs,
68 PhabricatorDocumentRef
$ref = null) {
72 protected function willStageRef(PhabricatorDocumentRef
$ref) {
73 $drequest = $this->getDiffusionRequest();
75 $blame_uri = (string)$drequest->generateURI(
81 $ref->setBlameURI($blame_uri);
84 protected function willRenderRef(PhabricatorDocumentRef
$ref) {
85 $drequest = $this->getDiffusionRequest();
87 $ref->setSymbolMetadata($this->getSymbolMetadata());
89 $coverage = $drequest->loadCoverage();
90 if (strlen($coverage)) {
91 $ref->addCoverage($coverage);
95 private function getSymbolMetadata() {
96 $drequest = $this->getDiffusionRequest();
98 $repo = $drequest->getRepository();
99 $symbol_repos = nonempty($repo->getSymbolSources(), array());
100 $symbol_repos[] = $repo->getPHID();
102 $lang = last(explode('.', $drequest->getPath()));
105 'repositories' => $symbol_repos,
107 'path' => $drequest->getPath(),