1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00
phorge-phorge/src/applications/project/conduit/ConduitAPI_project_Method.php

44 lines
1.1 KiB
PHP
Raw Normal View History

<?php
/**
* @group conduit
*/
abstract class ConduitAPI_project_Method extends ConduitAPIMethod {
public function getApplication() {
return PhabricatorApplication::getByClass(
'PhabricatorApplicationProject');
}
protected function buildProjectInfoDictionary(PhabricatorProject $project) {
$results = $this->buildProjectInfoDictionaries(array($project));
return idx($results, $project->getPHID());
}
protected function buildProjectInfoDictionaries(array $projects) {
assert_instances_of($projects, 'PhabricatorProject');
if (!$projects) {
return array();
}
$result = array();
foreach ($projects as $project) {
$member_phids = $project->getMemberPHIDs();
$member_phids = array_values($member_phids);
$result[$project->getPHID()] = array(
'id' => $project->getID(),
'phid' => $project->getPHID(),
'name' => $project->getName(),
'members' => $member_phids,
'dateCreated' => $project->getDateCreated(),
'dateModified' => $project->getDateModified(),
);
}
return $result;
}
}