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;
 }
 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;
 }