当前位置: 首页>>代码示例>>PHP>>正文


PHP ConduitAPIRequest::getAuditReasons方法代码示例

本文整理汇总了PHP中ConduitAPIRequest::getAuditReasons方法的典型用法代码示例。如果您正苦于以下问题:PHP ConduitAPIRequest::getAuditReasons方法的具体用法?PHP ConduitAPIRequest::getAuditReasons怎么用?PHP ConduitAPIRequest::getAuditReasons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConduitAPIRequest的用法示例。


在下文中一共展示了ConduitAPIRequest::getAuditReasons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $query = id(new DiffusionCommitQuery())->setViewer($request->getUser())->needAuditRequests(true);
     $auditor_phids = $request->getValue('auditorPHIDs', array());
     if ($auditor_phids) {
         $query->withAuditorPHIDs($auditor_phids);
     }
     $commit_phids = $request->getValue('commitPHIDs', array());
     if ($commit_phids) {
         $query->withPHIDs($commit_phids);
     }
     $status = $request->getValue('status', DiffusionCommitQuery::AUDIT_STATUS_ANY);
     $query->withAuditStatus($status);
     // NOTE: These affect the number of commits identified, which is sort of
     // reasonable but means the method may return an arbitrary number of
     // actual audit requests.
     $query->setOffset($request->getValue('offset', 0));
     $query->setLimit($request->getValue('limit', 100));
     $commits = $query->execute();
     $auditor_map = array_fuse($auditor_phids);
     $results = array();
     foreach ($commits as $commit) {
         $requests = $commit->getAudits();
         foreach ($requests as $request) {
             // If this audit isn't triggered for one of the requested PHIDs,
             // skip it.
             if ($auditor_map && empty($auditor_map[$request->getAuditorPHID()])) {
                 continue;
             }
             $results[] = array('id' => $request->getID(), 'commitPHID' => $request->getCommitPHID(), 'auditorPHID' => $request->getAuditorPHID(), 'reasons' => $request->getAuditReasons(), 'status' => $request->getAuditStatus());
         }
     }
     return $results;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:34,代码来源:AuditQueryConduitAPIMethod.php

示例2: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $query = new PhabricatorAuditQuery();
     $auditor_phids = $request->getValue('auditorPHIDs', array());
     if ($auditor_phids) {
         $query->withAuditorPHIDs($auditor_phids);
     }
     $commit_phids = $request->getValue('commitPHIDs', array());
     if ($commit_phids) {
         $query->withCommitPHIDs($commit_phids);
     }
     $status = $request->getValue('status', PhabricatorAuditQuery::STATUS_ANY);
     $query->withStatus($status);
     $query->setOffset($request->getValue('offset', 0));
     $query->setLimit($request->getValue('limit', 100));
     $requests = $query->execute();
     $results = array();
     foreach ($requests as $request) {
         $results[] = array('id' => $request->getID(), 'commitPHID' => $request->getCommitPHID(), 'auditorPHID' => $request->getAuditorPHID(), 'reasons' => $request->getAuditReasons(), 'status' => $request->getAuditStatus());
     }
     return $results;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:22,代码来源:ConduitAPI_audit_query_Method.php


注:本文中的ConduitAPIRequest::getAuditReasons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。