Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/query/PholioMockQuery.php
<?php | <?php | ||||
/** | /** | ||||
* @group pholio | * @group pholio | ||||
*/ | */ | ||||
final class PholioMockQuery | final class PholioMockQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $authorPHIDs; | private $authorPHIDs; | ||||
private $statuses; | |||||
private $needCoverFiles; | private $needCoverFiles; | ||||
private $needImages; | private $needImages; | ||||
private $needInlineComments; | private $needInlineComments; | ||||
private $needTokenCounts; | private $needTokenCounts; | ||||
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 withAuthorPHIDs(array $author_phids) { | public function withAuthorPHIDs(array $author_phids) { | ||||
$this->authorPHIDs = $author_phids; | $this->authorPHIDs = $author_phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withStatuses(array $statuses) { | |||||
$this->statuses = $statuses; | |||||
return $this; | |||||
} | |||||
public function needCoverFiles($need_cover_files) { | public function needCoverFiles($need_cover_files) { | ||||
$this->needCoverFiles = $need_cover_files; | $this->needCoverFiles = $need_cover_files; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function needImages($need_images) { | public function needImages($need_images) { | ||||
$this->needImages = $need_images; | $this->needImages = $need_images; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | private function buildWhereClause(AphrontDatabaseConnection $conn_r) { | ||||
if ($this->authorPHIDs) { | if ($this->authorPHIDs) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn_r, | ||||
'authorPHID in (%Ls)', | 'authorPHID in (%Ls)', | ||||
$this->authorPHIDs); | $this->authorPHIDs); | ||||
} | } | ||||
if ($this->statuses) { | |||||
$where[] = qsprintf( | |||||
$conn_r, | |||||
'status IN (%Ls)', | |||||
$this->statuses); | |||||
} | |||||
return $this->formatWhereClause($where); | return $this->formatWhereClause($where); | ||||
} | } | ||||
private function loadImages(array $mocks) { | private function loadImages(array $mocks) { | ||||
assert_instances_of($mocks, 'PholioMock'); | assert_instances_of($mocks, 'PholioMock'); | ||||
$mock_map = mpull($mocks, null, 'getID'); | $mock_map = mpull($mocks, null, 'getID'); | ||||
$all_images = id(new PholioImageQuery()) | $all_images = id(new PholioImageQuery()) | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |