2013-02-15 16:47:14 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class ConduitAPI_token_Method extends ConduitAPIMethod {
|
|
|
|
|
2013-03-13 15:09:05 +01:00
|
|
|
public function getApplication() {
|
2014-07-23 02:03:09 +02:00
|
|
|
return PhabricatorApplication::getByClass('PhabricatorTokensApplication');
|
2013-03-13 15:09:05 +01:00
|
|
|
}
|
|
|
|
|
2013-02-15 16:47:14 +01:00
|
|
|
public function getMethodStatus() {
|
|
|
|
return self::METHOD_STATUS_UNSTABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildTokenDicts(array $tokens) {
|
|
|
|
assert_instances_of($tokens, 'PhabricatorToken');
|
|
|
|
|
|
|
|
$list = array();
|
|
|
|
foreach ($tokens as $token) {
|
|
|
|
$list[] = array(
|
|
|
|
'id' => $token->getID(),
|
|
|
|
'name' => $token->getName(),
|
|
|
|
'phid' => $token->getPHID(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildTokenGivenDicts(array $tokens_given) {
|
|
|
|
assert_instances_of($tokens_given, 'PhabricatorTokenGiven');
|
|
|
|
|
|
|
|
$list = array();
|
|
|
|
foreach ($tokens_given as $given) {
|
|
|
|
$list[] = array(
|
|
|
|
'authorPHID' => $given->getAuthorPHID(),
|
|
|
|
'objectPHID' => $given->getObjectPHID(),
|
|
|
|
'tokenPHID' => $given->getTokenPHID(),
|
|
|
|
'dateCreated' => $given->getDateCreated(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|