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


PHP DifferentialRevision::getAttachedPHIDs方法代码示例

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


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

示例1: getRevisionProperties

 private function getRevisionProperties(DifferentialRevision $revision, DifferentialDiff $diff, array $handles, array $diff_properties)
 {
     $properties = array();
     $status = $revision->getStatus();
     $next_step = null;
     if ($status == DifferentialRevisionStatus::ACCEPTED) {
         switch ($diff->getSourceControlSystem()) {
             case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                 $next_step = 'arc amend --revision ' . $revision->getID();
                 break;
             case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                 $next_step = 'arc commit --revision ' . $revision->getID();
                 break;
         }
         if ($next_step) {
             $next_step = ' &middot; ' . 'Next step: <tt>' . phutil_escape_html($next_step) . '</tt>';
         }
     }
     $status = DifferentialRevisionStatus::getNameForRevisionStatus($status);
     $properties['Revision Status'] = '<strong>' . $status . '</strong>' . $next_step;
     $author = $handles[$revision->getAuthorPHID()];
     $properties['Author'] = $author->renderLink();
     $properties['Reviewers'] = $this->renderHandleLinkList(array_select_keys($handles, $revision->getReviewers()));
     $properties['CCs'] = $this->renderHandleLinkList(array_select_keys($handles, $revision->getCCPHIDs()));
     $host = $diff->getSourceMachine();
     if ($host) {
         $properties['Host'] = phutil_escape_html($host);
     }
     $path = $diff->getSourcePath();
     if ($path) {
         $branch = $diff->getBranch() ? ' (' . $diff->getBranch() . ')' : '';
         $properties['Path'] = phutil_escape_html("{$path} {$branch}");
     }
     $lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
     $lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
     $ldata = idx($diff_properties, 'arc:lint');
     $ltail = null;
     if ($ldata) {
         $ldata = igroup($ldata, 'path');
         $lint_messages = array();
         foreach ($ldata as $path => $messages) {
             $message_markup = array();
             foreach ($messages as $message) {
                 $path = idx($message, 'path');
                 $line = idx($message, 'line');
                 $code = idx($message, 'code');
                 $severity = idx($message, 'severity');
                 $name = idx($message, 'name');
                 $description = idx($message, 'description');
                 $message_markup[] = '<li>' . '<span class="lint-severity-' . phutil_escape_html($severity) . '">' . phutil_escape_html(ucwords($severity)) . '</span>' . ' ' . '(' . phutil_escape_html($code) . ') ' . phutil_escape_html($name) . ' at line ' . phutil_escape_html($line) . '<p>' . phutil_escape_html($description) . '</p>' . '</li>';
             }
             $lint_messages[] = '<li class="lint-file-block">' . 'Lint for <strong>' . phutil_escape_html($path) . '</strong>' . '<ul>' . implode("\n", $message_markup) . '</ul>' . '</li>';
         }
         $ltail = '<div class="differential-lint-block">' . '<ul>' . implode("\n", $lint_messages) . '</ul>' . '</div>';
     }
     $properties['Lint'] = $lstar . ' ' . $lmsg . $ltail;
     $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
     $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
     $postponed_count = 0;
     $udata = idx($diff_properties, 'arc:unit');
     $utail = null;
     if ($udata) {
         $unit_messages = array();
         foreach ($udata as $test) {
             $name = phutil_escape_html(idx($test, 'name'));
             $result = phutil_escape_html(idx($test, 'result'));
             if ($result != DifferentialUnitTestResult::RESULT_POSTPONED && $result != DifferentialUnitTestResult::RESULT_PASS) {
                 $userdata = phutil_escape_html(idx($test, 'userdata'));
                 if (strlen($userdata) > 256) {
                     $userdata = substr($userdata, 0, 256) . '...';
                 }
                 $userdata = str_replace("\n", '<br />', $userdata);
                 $unit_messages[] = '<tr>' . '<th>' . $name . '</th>' . '<th class="unit-test-result">' . '<div class="result-' . $result . '">' . strtoupper($result) . '</div>' . '</th>' . '<td>' . $userdata . '</td>' . '</tr>';
                 $utail = '<div class="differential-unit-block">' . '<table class="differential-unit-table">' . implode("\n", $unit_messages) . '</table>' . '</div>';
             } else {
                 if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) {
                     $postponed_count++;
                 }
             }
         }
     }
     if ($postponed_count > 0 && $diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
         $umsg = $postponed_count . ' ' . $umsg;
     }
     $properties['Unit'] = $ustar . ' ' . $umsg . $utail;
     if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
         $tasks = $revision->getAttachedPHIDs(PhabricatorPHIDConstants::PHID_TYPE_TASK);
         if ($tasks) {
             $links = array();
             foreach ($tasks as $task_phid) {
                 $links[] = $handles[$task_phid]->renderLink();
             }
             $properties['Maniphest Tasks'] = implode('<br />', $links);
         }
     }
     $commit_phids = $revision->getCommitPHIDs();
     if ($commit_phids) {
         $links = array();
         foreach ($commit_phids as $commit_phid) {
             $links[] = $handles[$commit_phid]->renderLink();
//.........这里部分代码省略.........
开发者ID:hunterbridges,项目名称:phabricator,代码行数:101,代码来源:DifferentialRevisionViewController.php


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