[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/repository/storage/ -> PhabricatorRepositorySymbol.php (source)

   1  <?php
   2  
   3  /**
   4   * Records information about symbol locations in a codebase, like where classes
   5   * and functions are defined.
   6   *
   7   * Query symbols with @{class:DiffusionSymbolQuery}.
   8   */
   9  final class PhabricatorRepositorySymbol extends PhabricatorRepositoryDAO {
  10  
  11    protected $arcanistProjectID;
  12    protected $symbolContext;
  13    protected $symbolName;
  14    protected $symbolType;
  15    protected $symbolLanguage;
  16    protected $pathID;
  17    protected $lineNumber;
  18  
  19    private $path = self::ATTACHABLE;
  20    private $arcanistProject = self::ATTACHABLE;
  21    private $repository = self::ATTACHABLE;
  22  
  23    public function getConfiguration() {
  24      return array(
  25        self::CONFIG_IDS => self::IDS_MANUAL,
  26        self::CONFIG_TIMESTAMPS => false,
  27        self::CONFIG_COLUMN_SCHEMA => array(
  28          'id' => null,
  29          'symbolContext' => 'text128',
  30          'symbolName' => 'text128',
  31          'symbolType' => 'text12',
  32          'symbolLanguage' => 'text32',
  33          'lineNumber' => 'uint32',
  34        ),
  35        self::CONFIG_KEY_SCHEMA => array(
  36          'PRIMARY' => null,
  37          'symbolName' => array(
  38            'columns' => array('symbolName'),
  39          ),
  40        ),
  41      ) + parent::getConfiguration();
  42    }
  43  
  44    public function getURI() {
  45      if (!$this->repository) {
  46        // This symbol is in the index, but we don't know which Repository it's
  47        // part of. Usually this means the Arcanist Project hasn't been linked
  48        // to a Repository. We can't generate a URI, so just fail.
  49        return null;
  50      }
  51  
  52      $request = DiffusionRequest::newFromDictionary(
  53        array(
  54          'user' => PhabricatorUser::getOmnipotentUser(),
  55          'repository' => $this->getRepository(),
  56        ));
  57      return $request->generateURI(
  58        array(
  59          'action'    => 'browse',
  60          'path'      => $this->getPath(),
  61          'line'      => $this->getLineNumber(),
  62        ));
  63    }
  64  
  65    public function getPath() {
  66      return $this->assertAttached($this->path);
  67    }
  68  
  69    public function attachPath($path) {
  70      $this->path = $path;
  71      return $this;
  72    }
  73  
  74    public function getRepository() {
  75      return $this->assertAttached($this->repository);
  76    }
  77  
  78    public function attachRepository($repository) {
  79      $this->repository = $repository;
  80      return $this;
  81    }
  82  
  83    public function getArcanistProject() {
  84      return $this->assertAttached($this->arcanistProject);
  85    }
  86  
  87    public function attachArcanistProject($project) {
  88      $this->arcanistProject = $project;
  89      return $this;
  90    }
  91  
  92  }


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