Changeset View
Changeset View
Standalone View
Standalone View
src/applications/fact/engine/PhabricatorFactEngine.php
<?php | <?php | ||||
abstract class PhabricatorFactEngine extends Phobject { | abstract class PhabricatorFactEngine extends Phobject { | ||||
private $factMap; | private $factMap; | ||||
private $viewer; | |||||
final public static function loadAllEngines() { | final public static function loadAllEngines() { | ||||
return id(new PhutilClassMapQuery()) | return id(new PhutilClassMapQuery()) | ||||
->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
->execute(); | ->execute(); | ||||
} | } | ||||
abstract public function newFacts(); | abstract public function newFacts(); | ||||
Show All 16 Lines | if (!isset($this->factMap[$key])) { | ||||
'Unknown fact ("%s") for engine "%s".', | 'Unknown fact ("%s") for engine "%s".', | ||||
$key, | $key, | ||||
get_class($this))); | get_class($this))); | ||||
} | } | ||||
return $this->factMap[$key]; | return $this->factMap[$key]; | ||||
} | } | ||||
final protected function getViewer() { | public function setViewer(PhabricatorUser $viewer) { | ||||
return PhabricatorUser::getOmnipotentUser(); | $this->viewer = $viewer; | ||||
return $this; | |||||
} | |||||
public function getViewer() { | |||||
if (!$this->viewer) { | |||||
throw new PhutilInvalidStateException('setViewer'); | |||||
} | |||||
return $this->viewer; | |||||
} | } | ||||
} | } |