~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/src/applications/diviner/publisher/DivinerPublisher.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-06-13 10:52:10 UTC
  • mfrom: (0.30.1) (0.29.1) (0.17.4) (2.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20150613105210-5uirr7tvnk0n6e6y
Tags: 0~git20150613-1
* New snapshot release (closes: #787805)
* fixed typo in logrotate script (closes: #787645)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
  private $symbolReverseMap;
11
11
  private $dropCaches;
12
12
 
13
 
  public final function setDropCaches($drop_caches) {
 
13
  final public function setDropCaches($drop_caches) {
14
14
    $this->dropCaches = $drop_caches;
15
15
    return $this;
16
16
  }
17
17
 
18
 
  public final function setRenderer(DivinerRenderer $renderer) {
 
18
  final public function setRenderer(DivinerRenderer $renderer) {
19
19
    $renderer->setPublisher($this);
20
20
    $this->renderer = $renderer;
21
21
    return $this;
22
22
  }
23
23
 
24
 
  public final function getRenderer() {
 
24
  final public function getRenderer() {
25
25
    return $this->renderer;
26
26
  }
27
27
 
28
 
  public final function setConfig(array $config) {
 
28
  final public function setConfig(array $config) {
29
29
    $this->config = $config;
30
30
    return $this;
31
31
  }
32
32
 
33
 
  public final function getConfig($key, $default = null) {
 
33
  final public function getConfig($key, $default = null) {
34
34
    return idx($this->config, $key, $default);
35
35
  }
36
36
 
37
 
  public final function getConfigurationData() {
 
37
  final public function getConfigurationData() {
38
38
    return $this->config;
39
39
  }
40
40
 
41
 
  public final function setAtomCache(DivinerAtomCache $cache) {
 
41
  final public function setAtomCache(DivinerAtomCache $cache) {
42
42
    $this->atomCache = $cache;
43
43
    $graph_map = $this->atomCache->getGraphMap();
44
44
    $this->atomGraphHashToNodeHashMap = array_flip($graph_map);
45
45
    return $this;
46
46
  }
47
47
 
48
 
  protected final function getAtomFromGraphHash($graph_hash) {
 
48
  final protected function getAtomFromGraphHash($graph_hash) {
49
49
    if (empty($this->atomGraphHashToNodeHashMap[$graph_hash])) {
50
50
      throw new Exception(pht("No such atom '%s'!", $graph_hash));
51
51
    }
54
54
      $this->atomGraphHashToNodeHashMap[$graph_hash]);
55
55
  }
56
56
 
57
 
  protected final function getAtomFromNodeHash($node_hash) {
 
57
  final protected function getAtomFromNodeHash($node_hash) {
58
58
    if (empty($this->atomMap[$node_hash])) {
59
59
      $dict = $this->atomCache->getAtom($node_hash);
60
60
      $this->atomMap[$node_hash] = DivinerAtom::newFromDictionary($dict);
62
62
    return $this->atomMap[$node_hash];
63
63
  }
64
64
 
65
 
  protected final function getSimilarAtoms(DivinerAtom $atom) {
 
65
  final protected function getSimilarAtoms(DivinerAtom $atom) {
66
66
    if ($this->symbolReverseMap === null) {
67
67
      $rmap = array();
68
68
      $smap = $this->atomCache->getSymbolMap();
94
94
   * `f()`, we assign them an arbitrary (but fairly stable) order and publish
95
95
   * them as `function/f/1/`, `function/f/2/`, etc., or similar.
96
96
   */
97
 
  protected final function getAtomSimilarIndex(DivinerAtom $atom) {
 
97
  final protected function getAtomSimilarIndex(DivinerAtom $atom) {
98
98
    $atoms = $this->getSimilarAtoms($atom);
99
99
    if (count($atoms) == 1) {
100
100
      return 0;
116
116
  abstract protected function createDocumentsByHash(array $hashes);
117
117
  abstract public function findAtomByRef(DivinerAtomRef $ref);
118
118
 
119
 
  public final function publishAtoms(array $hashes) {
 
119
  final public function publishAtoms(array $hashes) {
120
120
    $existing = $this->loadAllPublishedHashes();
121
121
 
122
122
    if ($this->dropCaches) {
140
140
    $this->createDocumentsByHash($created);
141
141
  }
142
142
 
143
 
  protected final function shouldGenerateDocumentForAtom(DivinerAtom $atom) {
 
143
  final protected function shouldGenerateDocumentForAtom(DivinerAtom $atom) {
144
144
    switch ($atom->getType()) {
145
145
      case DivinerAtom::TYPE_METHOD:
146
146
      case DivinerAtom::TYPE_FILE: