[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/controller/ -> DiffusionPathTreeController.php (source)

   1  <?php
   2  
   3  final class DiffusionPathTreeController extends DiffusionController {
   4  
   5    public function processRequest() {
   6      $drequest = $this->getDiffusionRequest();
   7  
   8      if (!$drequest->getRepository()->canUsePathTree()) {
   9        return new Aphront404Response();
  10      }
  11  
  12      $paths = $this->callConduitWithDiffusionRequest(
  13        'diffusion.querypaths',
  14        array(
  15          'path' => $drequest->getPath(),
  16          'commit' => $drequest->getCommit(),
  17        ));
  18  
  19      $tree = array();
  20      foreach ($paths as $path) {
  21        $parts = preg_split('((?<=/))', $path);
  22        $cursor = &$tree;
  23        foreach ($parts as $part) {
  24          if (!is_array($cursor)) {
  25            $cursor = array();
  26          }
  27          if (!isset($cursor[$part])) {
  28            $cursor[$part] = 1;
  29          }
  30          $cursor = &$cursor[$part];
  31        }
  32      }
  33  
  34      return id(new AphrontAjaxResponse())->setContent(array('tree' => $tree));
  35    }
  36  }


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