Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/query/PhabricatorRepositoryQuery.php
Show All 15 Lines | final class PhabricatorRepositoryQuery | ||||
private $status = self::STATUS_ALL; | private $status = self::STATUS_ALL; | ||||
const ORDER_CREATED = 'order-created'; | const ORDER_CREATED = 'order-created'; | ||||
const ORDER_COMMITTED = 'order-committed'; | const ORDER_COMMITTED = 'order-committed'; | ||||
const ORDER_CALLSIGN = 'order-callsign'; | const ORDER_CALLSIGN = 'order-callsign'; | ||||
const ORDER_NAME = 'order-name'; | const ORDER_NAME = 'order-name'; | ||||
private $order = self::ORDER_CREATED; | private $order = self::ORDER_CREATED; | ||||
const HOSTED_PHABRICATOR = 'hosted-phab'; | |||||
const HOSTED_REMOTE = 'hosted-remote'; | |||||
const HOSTED_ALL = 'hosted-all'; | |||||
private $hosted = self::HOSTED_ALL; | |||||
private $needMostRecentCommits; | private $needMostRecentCommits; | ||||
private $needCommitCounts; | private $needCommitCounts; | ||||
private $needProjectPHIDs; | private $needProjectPHIDs; | ||||
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; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withCallsigns(array $callsigns) { | public function withCallsigns(array $callsigns) { | ||||
$this->callsigns = $callsigns; | $this->callsigns = $callsigns; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withStatus($status) { | public function withStatus($status) { | ||||
$this->status = $status; | $this->status = $status; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withHosted($hosted) { | |||||
$this->hosted = $hosted; | |||||
return $this; | |||||
} | |||||
public function withTypes(array $types) { | public function withTypes(array $types) { | ||||
$this->types = $types; | $this->types = $types; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withUUIDs(array $uuids) { | public function withUUIDs(array $uuids) { | ||||
$this->uuids = $uuids; | $this->uuids = $uuids; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | foreach ($repositories as $key => $repo) { | ||||
unset($repositories[$key]); | unset($repositories[$key]); | ||||
} | } | ||||
break; | break; | ||||
case self::STATUS_ALL: | case self::STATUS_ALL: | ||||
break; | break; | ||||
default: | default: | ||||
throw new Exception("Unknown status '{$status}'!"); | throw new Exception("Unknown status '{$status}'!"); | ||||
} | } | ||||
$hosted = $this->hosted; | |||||
switch ($hosted) { | |||||
case self::HOSTED_PHABRICATOR: | |||||
if (!$repo->isHosted()) { | |||||
unset($repositories[$key]); | |||||
} | |||||
break; | |||||
case self::HOSTED_REMOTE: | |||||
if ($repo->isHosted()) { | |||||
unset($repositories[$key]); | |||||
} | |||||
break; | |||||
case self::HOSTED_ALL: | |||||
break; | |||||
default: | |||||
throw new Exception("Uknown hosted failed '${hosted}'!"); | |||||
} | |||||
} | } | ||||
return $repositories; | return $repositories; | ||||
} | } | ||||
public function didFilterPage(array $repositories) { | public function didFilterPage(array $repositories) { | ||||
if ($this->needProjectPHIDs) { | if ($this->needProjectPHIDs) { | ||||
$type_project = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; | $type_project = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; | ||||
▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines |