本文整理汇总了PHP中igroup函数的典型用法代码示例。如果您正苦于以下问题:PHP igroup函数的具体用法?PHP igroup怎么用?PHP igroup使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了igroup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNavItems
private function buildNavItems()
{
$classes = $this->getAllMethodImplementationClasses();
$method_names = array();
foreach ($classes as $method_class) {
$method_name = ConduitAPIMethod::getAPIMethodNameFromClassName($method_class);
$parts = explode('.', $method_name);
$method_names[] = array('full_name' => $method_name, 'group_name' => reset($parts));
}
$method_names = igroup($method_names, 'group_name');
ksort($method_names);
$items = array();
foreach ($method_names as $group => $methods) {
$items[] = phutil_render_tag('a', array(), phutil_escape_html($group));
foreach ($methods as $method) {
$method_name = $method['full_name'];
$selected = $method_name == $this->method;
$items[] = phutil_render_tag('a', array('class' => $selected ? 'aphront-side-nav-selected' : null, 'href' => '/conduit/method/' . $method_name), '<span style="padding-left: 1em;">' . phutil_escape_html($method_name) . '</span>');
}
$items[] = '<hr />';
}
// Pop off the last '<hr />'.
array_pop($items);
return $items;
}
示例2: renderValueForRevisionView
public function renderValueForRevisionView()
{
$diff = $this->getDiff();
$path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFilename');
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('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');
$line_link = phutil_escape_html($line);
if (isset($path_changesets[$path])) {
// TODO: Create standalone links for large diffs. Logic is in
// DifferentialDiffTableOfContentsView::renderChangesetLink().
$line_link = phutil_render_tag('a', array('href' => '#C' . $path_changesets[$path] . 'NL' . $line), $line_link);
}
$message_markup[] = hsprintf('<li>' . '<span class="lint-severity-%s">%s</span> (%s) %s ' . 'at line ' . $line_link . '<p>%s</p>' . '</li>', $severity, ucwords($severity), $code, $name, $description);
}
$lint_messages[] = '<li class="lint-file-block">' . 'Lint for <strong>' . phutil_escape_html($path) . '</strong>' . '<ul>' . implode("\n", $message_markup) . '</ul>' . '</li>';
}
$lexcuse = $this->getLintExcuse();
$ltail = '<div class="differential-lint-block">' . $lexcuse . '<ul>' . implode("\n", $lint_messages) . '</ul>' . '</div>';
}
return $lstar . ' ' . $lmsg . $ltail;
}
示例3: renderValueForRevisionView
public function renderValueForRevisionView()
{
$diff = $this->getDiff();
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('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>';
}
return $lstar . ' ' . $lmsg . $ltail;
}
示例4: executeListCommand
public function executeListCommand()
{
$symbols = $this->loadAvailableDaemonClasses();
$symbols = igroup($symbols, 'library');
echo "\n";
foreach ($symbols as $library => $symbol_list) {
echo phutil_console_format("Daemons in library __%s__:\n", $library);
foreach ($symbol_list as $symbol) {
echo " " . $symbol['name'] . "\n";
}
echo "\n";
}
return 0;
}
示例5: execute
public function execute(PhutilArgumentParser $args)
{
$console = PhutilConsole::getConsole();
$symbols = $this->loadAvailableDaemonClasses();
$symbols = igroup($symbols, 'library');
foreach ($symbols as $library => $symbol_list) {
$console->writeOut(pht('Daemons in library __%s__:', $library) . "\n");
foreach ($symbol_list as $symbol) {
$console->writeOut(" %s\n", $symbol['name']);
}
$console->writeOut("\n");
}
return 0;
}
示例6: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$board_id = $request->getURIData('projectID');
$board = id(new PhabricatorProjectQuery())->setViewer($viewer)->withIDs(array($board_id))->needImages(true)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$board) {
return new Aphront404Response();
}
if (!$board->getHasWorkboard()) {
return new Aphront404Response();
}
$this->setProject($board);
$id = $board->getID();
$manage_uri = $this->getApplicationURI("board/{$id}/manage/");
if ($request->isFormPost()) {
$background_key = $request->getStr('backgroundKey');
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())->setTransactionType(PhabricatorProjectTransaction::TYPE_BACKGROUND)->setNewValue($background_key);
id(new PhabricatorProjectTransactionEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($board, $xactions);
return id(new AphrontRedirectResponse())->setURI($manage_uri);
}
$nav = $this->getProfileMenu();
$crumbs = id($this->buildApplicationCrumbs())->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/")->addTextCrumb(pht('Manage'), $manage_uri)->addTextCrumb(pht('Background Color'));
$form = id(new AphrontFormView())->setUser($viewer);
$group_info = array('basic' => array('label' => pht('Basics')), 'solid' => array('label' => pht('Solid Colors')), 'gradient' => array('label' => pht('Gradients')));
$groups = array();
$options = PhabricatorProjectWorkboardBackgroundColor::getOptions();
$option_groups = igroup($options, 'group');
require_celerity_resource('people-profile-css');
require_celerity_resource('phui-workboard-color-css');
Javelin::initBehavior('phabricator-tooltips', array());
foreach ($group_info as $group_key => $spec) {
$buttons = array();
$available_options = idx($option_groups, $group_key, array());
foreach ($available_options as $option) {
$buttons[] = $this->renderOptionButton($option);
}
$form->appendControl(id(new AphrontFormMarkupControl())->setLabel($spec['label'])->setValue($buttons));
}
// NOTE: Each button is its own form, so we can't wrap them in a normal
// form.
$layout_view = $form->buildLayoutView();
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Edit Background Color'))->appendChild($layout_view);
return $this->newPage()->setTitle(array(pht('Edit Background Color'), $board->getDisplayName()))->setCrumbs($crumbs)->setNavigation($nav)->appendChild($form_box);
}
示例7: loadAllByContentTypeWithFullData
public static function loadAllByContentTypeWithFullData($content_type)
{
$rules = id(new HeraldRule())->loadAllWhere('contentType = %s', $content_type);
if (!$rules) {
return array();
}
$rule_ids = mpull($rules, 'getID');
$conditions = id(new HeraldCondition())->loadAllWhere('ruleID in (%Ld)', $rule_ids);
$actions = id(new HeraldAction())->loadAllWhere('ruleID in (%Ld)', $rule_ids);
$applied = queryfx_all(id(new HeraldRule())->establishConnection('r'), 'SELECT * FROM %T WHERE ruleID in (%Ld)', self::TABLE_RULE_APPLIED, $rule_ids);
$conditions = mgroup($conditions, 'getRuleID');
$actions = mgroup($actions, 'getRuleID');
$applied = igroup($applied, 'ruleID');
foreach ($rules as $rule) {
$rule->attachAllRuleApplied(idx($applied, $rule->getID(), array()));
$rule->attachConditions(idx($conditions, $rule->getID(), array()));
$rule->attachActions(idx($actions, $rule->getID(), array()));
}
return $rules;
}
示例8: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
require_celerity_resource('diviner-shared-css');
$book = id(new DivinerBookQuery())->setViewer($viewer)->withNames(array($this->bookName))->executeOne();
if (!$book) {
return new Aphront404Response();
}
// TODO: This query won't load ghosts, because they'll fail `needAtoms()`.
// Instead, we might want to load ghosts and render a message like
// "this thing existed in an older version, but no longer does", especially
// if we add content like comments.
$symbol = id(new DivinerAtomQuery())->setViewer($viewer)->withBookPHIDs(array($book->getPHID()))->withTypes(array($this->atomType))->withNames(array($this->atomName))->withContexts(array($this->atomContext))->withIndexes(array($this->atomIndex))->needAtoms(true)->needExtends(true)->needChildren(true)->executeOne();
if (!$symbol) {
return new Aphront404Response();
}
$atom = $symbol->getAtom();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($book->getShortTitle(), '/book/' . $book->getName() . '/');
$atom_short_title = $atom->getDocblockMetaValue('short', $symbol->getTitle());
$crumbs->addTextCrumb($atom_short_title);
$header = id(new PHUIHeaderView())->setHeader($this->renderFullSignature($symbol))->addTag(id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setBackgroundColor(PHUITagView::COLOR_BLUE)->setName(DivinerAtom::getAtomTypeNameString($atom->getType())));
$properties = id(new PHUIPropertyListView());
$group = $atom->getProperty('group');
if ($group) {
$group_name = $book->getGroupName($group);
} else {
$group_name = null;
}
$this->buildDefined($properties, $symbol);
$this->buildExtendsAndImplements($properties, $symbol);
$warnings = $atom->getWarnings();
if ($warnings) {
$warnings = id(new AphrontErrorView())->setErrors($warnings)->setTitle(pht('Documentation Warnings'))->setSeverity(AphrontErrorView::SEVERITY_WARNING);
}
$methods = $this->composeMethods($symbol);
$field = 'default';
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($symbol, $field);
foreach ($methods as $method) {
foreach ($method['atoms'] as $matom) {
$engine->addObject($matom, $field);
}
}
$engine->process();
$content = $this->renderDocumentationText($symbol, $engine);
$toc = $engine->getEngineMetadata($symbol, $field, PhutilRemarkupHeaderBlockRule::KEY_HEADER_TOC, array());
$document = id(new PHUIDocumentView())->setBook($book->getTitle(), $group_name)->setHeader($header)->addClass('diviner-view')->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS)->appendChild($properties)->appendChild($warnings)->appendChild($content);
$document->appendChild($this->buildParametersAndReturn(array($symbol)));
if ($methods) {
$tasks = $this->composeTasks($symbol);
if ($tasks) {
$methods_by_task = igroup($methods, 'task');
// Add phantom tasks for methods which have a "@task" name that isn't
// documented anywhere, or methods that have no "@task" name.
foreach ($methods_by_task as $task => $ignored) {
if (empty($tasks[$task])) {
$tasks[$task] = array('name' => $task, 'title' => $task ? $task : pht('Other Methods'), 'defined' => $symbol);
}
}
$section = id(new DivinerSectionView())->setHeader(pht('Tasks'));
foreach ($tasks as $spec) {
$section->addContent(id(new PHUIHeaderView())->setNoBackground(true)->setHeader($spec['title']));
$task_methods = idx($methods_by_task, $spec['name'], array());
$inner_box = id(new PHUIBoxView())->addPadding(PHUI::PADDING_LARGE_LEFT)->addPadding(PHUI::PADDING_LARGE_RIGHT)->addPadding(PHUI::PADDING_LARGE_BOTTOM);
$box_content = array();
if ($task_methods) {
$list_items = array();
foreach ($task_methods as $task_method) {
$atom = last($task_method['atoms']);
$item = $this->renderFullSignature($atom, true);
if (strlen($atom->getSummary())) {
$item = array($item, " — ", $atom->getSummary());
}
$list_items[] = phutil_tag('li', array(), $item);
}
$box_content[] = phutil_tag('ul', array('class' => 'diviner-list'), $list_items);
} else {
$no_methods = pht('No methods for this task.');
$box_content = phutil_tag('em', array(), $no_methods);
}
$inner_box->appendChild($box_content);
$section->addContent($inner_box);
}
$document->appendChild($section);
}
$section = id(new DivinerSectionView())->setHeader(pht('Methods'));
foreach ($methods as $spec) {
$matom = last($spec['atoms']);
$method_header = id(new PHUIHeaderView())->setNoBackground(true);
$inherited = $spec['inherited'];
if ($inherited) {
$method_header->addTag(id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setBackgroundColor(PHUITagView::COLOR_GREY)->setName(pht('Inherited')));
}
$method_header->setHeader($this->renderFullSignature($matom));
$section->addContent(array($method_header, $this->renderMethodDocumentationText($symbol, $spec, $engine), $this->buildParametersAndReturn($spec['atoms'])));
}
$document->appendChild($section);
}
if ($toc) {
//.........这里部分代码省略.........
示例9: loadHashes
private function loadHashes(AphrontDatabaseConnection $conn_r, array $revisions)
{
assert_instances_of($revisions, 'DifferentialRevision');
$data = queryfx_all($conn_r, 'SELECT * FROM %T WHERE revisionID IN (%Ld)', 'differential_revisionhash', mpull($revisions, 'getID'));
$data = igroup($data, 'revisionID');
foreach ($revisions as $revision) {
$hashes = idx($data, $revision->getID(), array());
$list = array();
foreach ($hashes as $hash) {
$list[] = array($hash['type'], $hash['hash']);
}
$revision->attachHashes($list);
}
}
示例10: executeExtendedPolicyChecks
private function executeExtendedPolicyChecks(array $extended_objects)
{
$viewer = $this->viewer;
$filter_capabilities = $this->capabilities;
// Iterate over the objects we need to filter and pull all the nonempty
// policies into a flat, structured list.
$all_structs = array();
foreach ($extended_objects as $key => $extended_object) {
foreach ($filter_capabilities as $extended_capability) {
$extended_policies = $extended_object->getExtendedPolicy($extended_capability, $viewer);
if (!$extended_policies) {
continue;
}
foreach ($extended_policies as $extended_policy) {
list($object, $capabilities) = $extended_policy;
// Build a description of the capabilities we need to check. This
// will be something like `"view"`, or `"edit view"`, or possibly
// a longer string with custom capabilities. Later, group the objects
// up into groups which need the same capabilities tested.
$capabilities = (array) $capabilities;
$capabilities = array_fuse($capabilities);
ksort($capabilities);
$group = implode(' ', $capabilities);
$struct = array('key' => $key, 'for' => $extended_capability, 'object' => $object, 'capabilities' => $capabilities, 'group' => $group);
$all_structs[] = $struct;
}
}
}
// Extract any bare PHIDs from the structs; we need to load these objects.
// These are objects which are required in order to perform an extended
// policy check but which the original viewer did not have permission to
// see (they presumably had other permissions which let them load the
// object in the first place).
$all_phids = array();
foreach ($all_structs as $idx => $struct) {
$object = $struct['object'];
if (is_string($object)) {
$all_phids[$object] = $object;
}
}
// If we have some bare PHIDs, we need to load the corresponding objects.
if ($all_phids) {
// We can pull these with the omnipotent user because we're immediately
// filtering them.
$ref_objects = id(new PhabricatorObjectQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($all_phids)->execute();
$ref_objects = mpull($ref_objects, null, 'getPHID');
} else {
$ref_objects = array();
}
// Group the list of checks by the capabilities we need to check.
$groups = igroup($all_structs, 'group');
foreach ($groups as $structs) {
$head = head($structs);
// All of the items in each group are checking for the same capabilities.
$capabilities = $head['capabilities'];
$key_map = array();
$objects_in = array();
foreach ($structs as $struct) {
$extended_key = $struct['key'];
if (empty($extended_objects[$key])) {
// If this object has already been rejected by an earlier filtering
// pass, we don't need to do any tests on it.
continue;
}
$object = $struct['object'];
if (is_string($object)) {
// This is really a PHID, so look it up.
$object_phid = $object;
if (empty($ref_objects[$object_phid])) {
// We weren't able to load the corresponding object, so just
// reject this result outright.
$reject = $extended_objects[$key];
unset($extended_objects[$key]);
// TODO: This could be friendlier.
$this->rejectObject($reject, false, '<bad-ref>');
continue;
}
$object = $ref_objects[$object_phid];
}
$phid = $object->getPHID();
$key_map[$phid][] = $extended_key;
$objects_in[$phid] = $object;
}
if ($objects_in) {
$objects_out = id(new PhabricatorPolicyFilter())->setViewer($viewer)->requireCapabilities($capabilities)->apply($objects_in);
$objects_out = mpull($objects_out, null, 'getPHID');
} else {
$objects_out = array();
}
// If any objects were removed by filtering, we're going to reject all
// of the original objects which needed them.
foreach ($objects_in as $phid => $object_in) {
if (isset($objects_out[$phid])) {
// This object survived filtering, so we don't need to throw any
// results away.
continue;
}
foreach ($key_map[$phid] as $extended_key) {
if (empty($extended_objects[$extended_key])) {
// We've already rejected this object, so we don't need to reject
//.........这里部分代码省略.........
示例11: attachRelationships
public function attachRelationships(array $relationships)
{
$this->relationships = igroup($relationships, 'relation');
return $this;
}
示例12: loadAvgs
public function loadAvgs()
{
$limit = 1000;
$conn_r = id(new DifferentialRevision())->establishConnection('r');
$sums = array();
$counts = array();
$all_not_reviewed = array();
$last_id = 0;
do {
$where = '';
if ($this->until !== null) {
$where .= qsprintf($conn_r, ' AND dateCreated < %d', $this->until);
}
if ($this->since) {
$where .= qsprintf($conn_r, ' AND (dateModified > %d OR status = %s)', $this->since, ArcanistDifferentialRevisionStatus::NEEDS_REVIEW);
}
$revisions = id(new DifferentialRevision())->loadAllWhere('id > %d%Q ORDER BY id LIMIT %d', $last_id, $where, $limit);
if (!$revisions) {
break;
}
$last_id = last_key($revisions);
$relations = queryfx_all($conn_r, 'SELECT * FROM %T WHERE revisionID IN (%Ld) AND relation = %s', DifferentialRevision::RELATIONSHIP_TABLE, array_keys($revisions), DifferentialRevision::RELATION_REVIEWER);
$relations = igroup($relations, 'revisionID');
$where = '';
if ($this->until !== null) {
$where = qsprintf($conn_r, ' AND dateCreated < %d', $this->until);
}
$all_comments = id(new DifferentialComment())->loadAllWhere('revisionID IN (%Ld)%Q ORDER BY revisionID, id', array_keys($revisions), $where);
$all_comments = mgroup($all_comments, 'getRevisionID');
foreach ($revisions as $id => $revision) {
$revision->attachRelationships(idx($relations, $id, array()));
$comments = idx($all_comments, $id, array());
list($reviewed, $not_reviewed) = $this->computeTimes($revision, $comments);
foreach ($reviewed as $phid => $times) {
$sums[$phid] = idx($sums, $phid, 0) + array_sum($times);
$counts[$phid] = idx($counts, $phid, 0) + count($times);
}
foreach ($not_reviewed as $phid => $times) {
$all_not_reviewed[$phid][] = $times;
}
}
} while (count($revisions) >= $limit);
foreach ($all_not_reviewed as $phid => $not_reviewed) {
if (!array_key_exists($phid, $counts)) {
// If the person didn't make any reviews than take maximum time because
// he is at least that slow.
$sums[$phid] = max(array_map('max', $not_reviewed));
$counts[$phid] = 1;
continue;
}
$avg = $sums[$phid] / $counts[$phid];
foreach ($not_reviewed as $times) {
foreach ($times as $time) {
// Don't shorten the average time just because the reviewer was lucky
// to be in a group with someone faster.
if ($time > $avg) {
$sums[$phid] += $time;
$counts[$phid]++;
}
}
}
}
$avgs = array();
foreach ($sums as $phid => $sum) {
$avgs[$phid] = $sum / $counts[$phid];
}
return $avgs;
}
示例13: getMethodFilters
protected function getMethodFilters()
{
$classes = $this->getAllMethodImplementationClasses();
$method_names = array();
foreach ($classes as $method_class) {
$method_name = ConduitAPIMethod::getAPIMethodNameFromClassName($method_class);
$group_name = head(explode('.', $method_name));
$method_object = newv($method_class, array());
$status = $method_object->getMethodStatus();
$key = sprintf('%02d %s %s', $this->getOrderForMethodStatus($status), $group_name, $method_name);
$method_names[$key] = array('full_name' => $method_name, 'group_name' => $group_name, 'status' => $status, 'description' => $method_object->getMethodDescription());
}
ksort($method_names);
$method_names = igroup($method_names, 'group_name');
ksort($method_names);
return $method_names;
}
示例14: loadDiffIDs
private function loadDiffIDs($conn_r, array $revisions)
{
assert_instances_of($revisions, 'DifferentialRevision');
$diff_table = new DifferentialDiff();
$diff_ids = queryfx_all($conn_r, 'SELECT revisionID, id FROM %T WHERE revisionID IN (%Ld)
ORDER BY id DESC', $diff_table->getTableName(), mpull($revisions, 'getID'));
$diff_ids = igroup($diff_ids, 'revisionID');
foreach ($revisions as $revision) {
$ids = idx($diff_ids, $revision->getID(), array());
$ids = ipull($ids, 'id');
$revision->attachDiffIDs($ids);
}
}
示例15: 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 = ' · ' . '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();
//.........这里部分代码省略.........