Changeset View
Changeset View
Standalone View
Standalone View
src/ref/symbol/ArcanistSymbolRef.php
<?php | <?php | ||||
abstract class ArcanistSymbolRef | abstract class ArcanistSymbolRef | ||||
extends ArcanistRef { | extends ArcanistRef { | ||||
private $symbol; | private $symbol; | ||||
private $cacheKey; | |||||
const HARDPOINT_OBJECT = 'ref.symbol.object'; | const HARDPOINT_OBJECT = 'ref.symbol.object'; | ||||
protected function newHardpoints() { | protected function newHardpoints() { | ||||
return array( | return array( | ||||
$this->newHardpoint(self::HARDPOINT_OBJECT), | $this->newHardpoint(self::HARDPOINT_OBJECT), | ||||
); | ); | ||||
} | } | ||||
final public function setSymbol($symbol) { | final public function setSymbol($symbol) { | ||||
$symbol = $this->resolveSymbol($symbol); | $symbol = $this->resolveSymbol($symbol); | ||||
$this->symbol = $symbol; | $this->symbol = $symbol; | ||||
return $this; | return $this; | ||||
} | } | ||||
final public function getSymbol() { | final public function getSymbol() { | ||||
return $this->symbol; | return $this->symbol; | ||||
} | } | ||||
final public function getSymbolEngineCacheKey() { | |||||
if ($this->cacheKey === null) { | |||||
$parts = array(); | |||||
$parts[] = sprintf('class(%s)', get_class($this)); | |||||
foreach ($this->newCacheKeyParts() as $part) { | |||||
$parts[] = $part; | |||||
} | |||||
$parts[] = $this->getSymbol(); | |||||
$this->cacheKey = implode('.', $parts); | |||||
} | |||||
return $this->cacheKey; | |||||
} | |||||
protected function newCacheKeyParts() { | |||||
return array(); | |||||
} | |||||
final public function attachObject(ArcanistRef $object) { | final public function attachObject(ArcanistRef $object) { | ||||
return $this->attachHardpoint(self::HARDPOINT_OBJECT, $object); | return $this->attachHardpoint(self::HARDPOINT_OBJECT, $object); | ||||
} | } | ||||
final public function getObject() { | final public function getObject() { | ||||
return $this->getHardpoint(self::HARDPOINT_OBJECT); | return $this->getHardpoint(self::HARDPOINT_OBJECT); | ||||
} | } | ||||
protected function resolveSymbol($symbol) { | protected function resolveSymbol($symbol) { | ||||
return $symbol; | return $symbol; | ||||
} | } | ||||
} | } |