1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 19:02:41 +01:00
phorge-phorge/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php

46 lines
1 KiB
PHP
Raw Normal View History

2011-04-07 04:17:05 +02:00
<?php
final class PhabricatorXHPASTViewTreeController
2011-04-07 04:17:05 +02:00
extends PhabricatorXHPASTViewPanelController {
public function processRequest() {
$storage = $this->getStorageTree();
$input = $storage->getInput();
$stdout = $storage->getStdout();
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array(0, $stdout, ''));
2013-02-13 23:50:15 +01:00
$tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode()));
2011-04-07 04:17:05 +02:00
return $this->buildXHPASTViewPanelResponse($tree);
}
protected function buildTree($root) {
try {
$name = $root->getTypeName();
$title = $root->getDescription();
} catch (Exception $ex) {
$name = '???';
$title = '???';
}
$tree = array();
2013-02-13 23:50:15 +01:00
$tree[] = phutil_tag(
'li',
array(),
phutil_tag(
'span',
array(
'title' => $title,
),
$name));
2011-04-07 04:17:05 +02:00
foreach ($root->getChildren() as $child) {
2013-02-13 23:50:15 +01:00
$tree[] = phutil_tag('ul', array(), $this->buildTree($child));
2011-04-07 04:17:05 +02:00
}
2013-02-13 23:50:15 +01:00
return phutil_implode_html("\n", $tree);
2011-04-07 04:17:05 +02:00
}
}