[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phpast/controller/ -> PhabricatorXHPASTViewTreeController.php (source)

   1  <?php
   2  
   3  final class PhabricatorXHPASTViewTreeController
   4    extends PhabricatorXHPASTViewPanelController {
   5  
   6    public function processRequest() {
   7      $storage = $this->getStorageTree();
   8      $input = $storage->getInput();
   9      $stdout = $storage->getStdout();
  10  
  11      $tree = XHPASTTree::newFromDataAndResolvedExecFuture(
  12        $input,
  13        array(0, $stdout, ''));
  14  
  15      $tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode()));
  16      return $this->buildXHPASTViewPanelResponse($tree);
  17    }
  18  
  19    protected function buildTree($root) {
  20  
  21      try {
  22        $name = $root->getTypeName();
  23        $title = $root->getDescription();
  24      } catch (Exception $ex) {
  25        $name = '???';
  26        $title = '???';
  27      }
  28  
  29      $tree = array();
  30      $tree[] = phutil_tag(
  31        'li',
  32        array(),
  33        phutil_tag(
  34          'span',
  35          array(
  36            'title' => $title,
  37          ),
  38          $name));
  39      foreach ($root->getChildren() as $child) {
  40        $tree[] = phutil_tag('ul', array(), $this->buildTree($child));
  41      }
  42      return phutil_implode_html("\n", $tree);
  43    }
  44  
  45  }


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