Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/query/PhabricatorConduitMethodQuery.php
<?php | <?php | ||||
final class PhabricatorConduitMethodQuery | final class PhabricatorConduitMethodQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $isDeprecated; | private $isDeprecated; | ||||
private $isStable; | private $isStable; | ||||
private $isUnstable; | private $isUnstable; | ||||
private $applicationNames; | private $applicationNames; | ||||
private $nameContains; | private $nameContains; | ||||
private $methods; | private $methods; | ||||
private $isInternal; | |||||
public function withMethods(array $methods) { | public function withMethods(array $methods) { | ||||
$this->methods = $methods; | $this->methods = $methods; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withNameContains($name_contains) { | public function withNameContains($name_contains) { | ||||
$this->nameContains = $name_contains; | $this->nameContains = $name_contains; | ||||
Show All 15 Lines | public function withIsUnstable($is_unstable) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withIsDeprecated($is_deprecated) { | public function withIsDeprecated($is_deprecated) { | ||||
$this->isDeprecated = $is_deprecated; | $this->isDeprecated = $is_deprecated; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withIsInternal($is_internal) { | |||||
$this->isInternal = $is_internal; | |||||
return $this; | |||||
} | |||||
protected function loadPage() { | protected function loadPage() { | ||||
$methods = $this->getAllMethods(); | $methods = $this->getAllMethods(); | ||||
$methods = $this->filterMethods($methods); | $methods = $this->filterMethods($methods); | ||||
return $methods; | return $methods; | ||||
} | } | ||||
private function getAllMethods() { | private function getAllMethods() { | ||||
return id(new PhutilClassMapQuery()) | return id(new PhutilClassMapQuery()) | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if ($this->methods) { | ||||
foreach ($methods as $key => $method) { | foreach ($methods as $key => $method) { | ||||
$needle = $method->getAPIMethodName(); | $needle = $method->getAPIMethodName(); | ||||
if (empty($map[$needle])) { | if (empty($map[$needle])) { | ||||
unset($methods[$key]); | unset($methods[$key]); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if ($this->isInternal !== null) { | |||||
foreach ($methods as $key => $method) { | |||||
if ($method->isInternalAPI() !== $this->isInternal) { | |||||
unset($methods[$key]); | |||||
} | |||||
} | |||||
} | |||||
return $methods; | return $methods; | ||||
} | } | ||||
protected function willFilterPage(array $methods) { | protected function willFilterPage(array $methods) { | ||||
$application_phids = array(); | $application_phids = array(); | ||||
foreach ($methods as $method) { | foreach ($methods as $method) { | ||||
$application = $method->getApplication(); | $application = $method->getApplication(); | ||||
if ($application === null) { | if ($application === null) { | ||||
Show All 37 Lines |