Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / diffusion / query / lowlevel / DiffusionLowLevelQuery.php
blobe14198371c3045087e6db572b415a54b354798f0
1 <?php
3 abstract class DiffusionLowLevelQuery extends Phobject {
5 private $repository;
7 abstract protected function executeQuery();
9 public function setRepository(PhabricatorRepository $repository) {
10 $this->repository = $repository;
11 return $this;
14 public function getRepository() {
15 return $this->repository;
18 public function execute() {
19 if (!$this->getRepository()) {
20 throw new PhutilInvalidStateException('setRepository');
23 return $this->executeQuery();
26 protected function filterRefsByType(array $refs, array $types) {
27 $type_map = array_fuse($types);
29 foreach ($refs as $name => $ref_list) {
30 foreach ($ref_list as $key => $ref) {
31 if (empty($type_map[$ref['type']])) {
32 unset($refs[$name][$key]);
35 if (!$refs[$name]) {
36 unset($refs[$name]);
40 return $refs;