Differential D14584 Diff 35308 src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
| <?php | <?php | ||||
| final class PhabricatorEditEngineConfigurationQuery | final class PhabricatorEditEngineConfigurationQuery | ||||
| extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
| private $ids; | private $ids; | ||||
| private $phids; | private $phids; | ||||
| private $engineKeys; | private $engineKeys; | ||||
| private $builtinKeys; | private $builtinKeys; | ||||
| private $identifiers; | private $identifiers; | ||||
| private $default; | |||||
| private $disabled; | |||||
| public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
| $this->ids = $ids; | $this->ids = $ids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
| $this->phids = $phids; | $this->phids = $phids; | ||||
| Show All 10 Lines | public function withBuiltinKeys(array $builtin_keys) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withIdentifiers(array $identifiers) { | public function withIdentifiers(array $identifiers) { | ||||
| $this->identifiers = $identifiers; | $this->identifiers = $identifiers; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withIsDefault($default) { | |||||
| $this->default = $default; | |||||
| return $this; | |||||
| } | |||||
| public function withIsDisabled($disabled) { | |||||
| $this->disabled = $disabled; | |||||
| return $this; | |||||
| } | |||||
| public function newResultObject() { | public function newResultObject() { | ||||
| return new PhabricatorEditEngineConfiguration(); | return new PhabricatorEditEngineConfiguration(); | ||||
| } | } | ||||
| protected function loadPage() { | protected function loadPage() { | ||||
| // TODO: The logic here is a little flimsy and won't survive pagination. | // TODO: The logic here is a little flimsy and won't survive pagination. | ||||
| // For now, I'm just not bothering with pagination since I believe it will | // For now, I'm just not bothering with pagination since I believe it will | ||||
| // take some time before any install manages to produce a large enough | // take some time before any install manages to produce a large enough | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if ($this->builtinKeys !== null) { | ||||
| $builtin_keys = array_fuse($this->builtinKeys); | $builtin_keys = array_fuse($this->builtinKeys); | ||||
| foreach ($page as $key => $config) { | foreach ($page as $key => $config) { | ||||
| if (empty($builtin_keys[$config->getBuiltinKey()])) { | if (empty($builtin_keys[$config->getBuiltinKey()])) { | ||||
| unset($page[$key]); | unset($page[$key]); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if ($this->default !== null) { | |||||
| foreach ($page as $key => $config) { | |||||
| if ($config->getIsDefault() != $this->default) { | |||||
| unset($page[$key]); | |||||
| } | |||||
| } | |||||
| } | |||||
| if ($this->disabled !== null) { | |||||
| foreach ($page as $key => $config) { | |||||
| if ($config->getIsDisabled() != $this->disabled) { | |||||
| unset($page[$key]); | |||||
| } | |||||
| } | |||||
| } | |||||
| if ($this->identifiers !== null) { | if ($this->identifiers !== null) { | ||||
| $identifiers = array_fuse($this->identifiers); | $identifiers = array_fuse($this->identifiers); | ||||
| foreach ($page as $key => $config) { | foreach ($page as $key => $config) { | ||||
| if (isset($identifiers[$config->getBuiltinKey()])) { | if (isset($identifiers[$config->getBuiltinKey()])) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (isset($identifiers[$config->getID()])) { | if (isset($identifiers[$config->getID()])) { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||