當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DifferentialRevision::getReviewerStatus方法代碼示例

本文整理匯總了PHP中DifferentialRevision::getReviewerStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP DifferentialRevision::getReviewerStatus方法的具體用法?PHP DifferentialRevision::getReviewerStatus怎麽用?PHP DifferentialRevision::getReviewerStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DifferentialRevision的用法示例。


在下文中一共展示了DifferentialRevision::getReviewerStatus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     $phids = array();
     foreach ($revision->getReviewerStatus() as $reviewer) {
         switch ($reviewer->getStatus()) {
             case DifferentialReviewerStatus::STATUS_ACCEPTED:
             case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER:
                 $phids[] = $reviewer->getReviewerPHID();
                 break;
         }
     }
     return $phids;
 }
開發者ID:pugong,項目名稱:phabricator,代碼行數:13,代碼來源:DifferentialReviewedByField.php

示例2: hasReviewersWithStatus

 protected function hasReviewersWithStatus(DifferentialRevision $revision, array $phids, array $statuses)
 {
     foreach ($revision->getReviewerStatus() as $reviewer) {
         $reviewer_phid = $reviewer->getReviewerPHID();
         if (empty($phids[$reviewer_phid])) {
             continue;
         }
         $status = $reviewer->getStatus();
         if (empty($statuses[$status])) {
             continue;
         }
         return true;
     }
     return false;
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:15,代碼來源:DifferentialRevisionResultBucket.php

示例3: getRevisionCommentActions

 private function getRevisionCommentActions(DifferentialRevision $revision)
 {
     $actions = array(DifferentialAction::ACTION_COMMENT => true);
     $viewer = $this->getRequest()->getUser();
     $viewer_phid = $viewer->getPHID();
     $viewer_is_owner = $viewer_phid == $revision->getAuthorPHID();
     $viewer_is_reviewer = in_array($viewer_phid, $revision->getReviewers());
     $status = $revision->getStatus();
     $viewer_has_accepted = false;
     $viewer_has_rejected = false;
     $status_accepted = DifferentialReviewerStatus::STATUS_ACCEPTED;
     $status_rejected = DifferentialReviewerStatus::STATUS_REJECTED;
     foreach ($revision->getReviewerStatus() as $reviewer) {
         if ($reviewer->getReviewerPHID() == $viewer_phid) {
             if ($reviewer->getStatus() == $status_accepted) {
                 $viewer_has_accepted = true;
             }
             if ($reviewer->getStatus() == $status_rejected) {
                 $viewer_has_rejected = true;
             }
             break;
         }
     }
     $allow_self_accept = PhabricatorEnv::getEnvConfig('differential.allow-self-accept');
     $always_allow_abandon = PhabricatorEnv::getEnvConfig('differential.always-allow-abandon');
     $always_allow_close = PhabricatorEnv::getEnvConfig('differential.always-allow-close');
     $allow_reopen = PhabricatorEnv::getEnvConfig('differential.allow-reopen');
     if ($viewer_is_owner) {
         switch ($status) {
             case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                 $actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept;
                 $actions[DifferentialAction::ACTION_ABANDON] = true;
                 $actions[DifferentialAction::ACTION_RETHINK] = true;
                 break;
             case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
             case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
                 $actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept;
                 $actions[DifferentialAction::ACTION_ABANDON] = true;
                 $actions[DifferentialAction::ACTION_REQUEST] = true;
                 break;
             case ArcanistDifferentialRevisionStatus::ACCEPTED:
                 $actions[DifferentialAction::ACTION_ABANDON] = true;
                 $actions[DifferentialAction::ACTION_REQUEST] = true;
                 $actions[DifferentialAction::ACTION_RETHINK] = true;
                 $actions[DifferentialAction::ACTION_CLOSE] = true;
                 break;
             case ArcanistDifferentialRevisionStatus::CLOSED:
                 break;
             case ArcanistDifferentialRevisionStatus::ABANDONED:
                 $actions[DifferentialAction::ACTION_RECLAIM] = true;
                 break;
         }
     } else {
         switch ($status) {
             case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                 $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
                 $actions[DifferentialAction::ACTION_ACCEPT] = true;
                 $actions[DifferentialAction::ACTION_REJECT] = true;
                 $actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
                 break;
             case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
             case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
                 $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
                 $actions[DifferentialAction::ACTION_ACCEPT] = true;
                 $actions[DifferentialAction::ACTION_REJECT] = !$viewer_has_rejected;
                 $actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
                 break;
             case ArcanistDifferentialRevisionStatus::ACCEPTED:
                 $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
                 $actions[DifferentialAction::ACTION_ACCEPT] = !$viewer_has_accepted;
                 $actions[DifferentialAction::ACTION_REJECT] = true;
                 $actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
                 break;
             case ArcanistDifferentialRevisionStatus::CLOSED:
             case ArcanistDifferentialRevisionStatus::ABANDONED:
                 break;
         }
         if ($status != ArcanistDifferentialRevisionStatus::CLOSED) {
             $actions[DifferentialAction::ACTION_CLAIM] = true;
             $actions[DifferentialAction::ACTION_CLOSE] = $always_allow_close;
         }
     }
     $actions[DifferentialAction::ACTION_ADDREVIEWERS] = true;
     $actions[DifferentialAction::ACTION_ADDCCS] = true;
     $actions[DifferentialAction::ACTION_REOPEN] = $allow_reopen && $status == ArcanistDifferentialRevisionStatus::CLOSED;
     $actions = array_keys(array_filter($actions));
     $actions_dict = array();
     foreach ($actions as $action) {
         $actions_dict[$action] = DifferentialAction::getActionVerb($action);
     }
     return $actions_dict;
 }
開發者ID:fengshao0907,項目名稱:phabricator,代碼行數:92,代碼來源:DifferentialRevisionViewController.php

示例4: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     return $revision->getReviewerStatus();
 }
開發者ID:denghp,項目名稱:phabricator,代碼行數:4,代碼來源:DifferentialReviewersField.php


注:本文中的DifferentialRevision::getReviewerStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。