Changeset View
Changeset View
Standalone View
Standalone View
src/inspector/ArcanistRefInspector.php
Show All 16 Lines | abstract class ArcanistRefInspector | ||||
abstract public function getInspectFunctionName(); | abstract public function getInspectFunctionName(); | ||||
abstract public function newInspectRef(array $argv); | abstract public function newInspectRef(array $argv); | ||||
protected function newInspectors() { | protected function newInspectors() { | ||||
return array($this); | return array($this); | ||||
} | } | ||||
final public static function getAllInspectors() { | final public static function getAllInspectors() { | ||||
$base_inspectors = id(new PhutilClassMapQuery()) | $base_inspectors = (new PhutilClassMapQuery()) | ||||
->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
->execute(); | ->execute(); | ||||
$results = array(); | $results = array(); | ||||
foreach ($base_inspectors as $base_inspector) { | foreach ($base_inspectors as $base_inspector) { | ||||
foreach ($base_inspector->newInspectors() as $inspector) { | foreach ($base_inspector->newInspectors() as $inspector) { | ||||
$results[] = $inspector; | $results[] = $inspector; | ||||
} | } | ||||
} | } | ||||
return mpull($results, null, 'getInspectFunctionName'); | return mpull($results, null, 'getInspectFunctionName'); | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0