• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP igroup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中igroup函数的典型用法代码示例。如果您正苦于以下问题:PHP igroup函数的具体用法?PHP igroup怎么用?PHP igroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了igroup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:hunterbridges,项目名称:phabricator,代码行数:25,代码来源:PhabricatorConduitConsoleController.php


示例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;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:35,代码来源:DifferentialLintFieldSpecification.php


示例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;
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:27,代码来源:DifferentialLintFieldSpecification.php


示例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;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:14,代码来源:PhabricatorDaemonControl.php


示例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;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:14,代码来源:PhabricatorDaemonManagementListWorkflow.php


示例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);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:45,代码来源:PhabricatorProjectBoardBackgroundController.php


示例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;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:20,代码来源:HeraldRule.php


示例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) {
//.........这里部分代码省略.........
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:DivinerAtomController.php


示例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);
     }
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:14,代码来源:DifferentialRevisionQuery.php


示例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
//.........这里部分代码省略.........
开发者ID:patelhardik,项目名称:phabricator,代码行数:101,代码来源:PhabricatorPolicyFilter.php


示例11: attachRelationships

 public function attachRelationships(array $relationships)
 {
     $this->relationships = igroup($relationships, 'relation');
     return $this;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:5,代码来源:DifferentialRevision.php


示例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;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:68,代码来源:DifferentialReviewerStats.php


示例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;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:17,代码来源:PhabricatorConduitController.php


示例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);
     }
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:13,代码来源:DifferentialRevisionQuery.php


示例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 = ' &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


示例16: 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;
     $rows = array();
     $rows[] = array('style' => 'star', 'name' => $lstar, 'value' => $lmsg, 'show' => true);
     $excuse = $this->getLintExcuse();
     if ($excuse) {
         $rows[] = array('style' => 'excuse', 'name' => 'Excuse', 'value' => nl2br(phutil_escape_html($excuse)), 'show' => true);
     }
     $show_limit = 10;
     $hidden = array();
     if ($ldata) {
         $ldata = igroup($ldata, 'path');
         foreach ($ldata as $path => $messages) {
             $rows[] = array('style' => 'section', 'name' => phutil_escape_html($path), 'show' => $show_limit);
             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 = 'line ' . intval($line);
                 if (isset($path_changesets[$path])) {
                     $line_link = phutil_render_tag('a', array('href' => '#C' . $path_changesets[$path] . 'NL' . max(1, $line)), $line_link);
                 }
                 if ($show_limit) {
                     --$show_limit;
                     $show = true;
                 } else {
                     $show = false;
                     if (empty($hidden[$severity])) {
                         $hidden[$severity] = 0;
                     }
                     $hidden[$severity]++;
                 }
                 $rows[] = array('style' => $this->getSeverityStyle($severity), 'name' => phutil_escape_html(ucwords($severity)), 'value' => hsprintf("(%s) %s at {$line_link}", $code, $name), 'show' => $show);
                 if (strlen($description)) {
                     $rows[] = array('style' => 'details', 'value' => nl2br(phutil_escape_html($description)), 'show' => false);
                     if (empty($hidden['details'])) {
                         $hidden['details'] = 0;
                     }
                     $hidden['details']++;
                 }
             }
         }
     }
     $postponed = $this->getPostponedLinters();
     if ($postponed) {
         foreach ($postponed as $linter) {
             $rows[] = array('style' => $this->getPostponedStyle(), 'name' => 'Postponed', 'value' => phutil_escape_html($linter), 'show' => false);
             if (empty($hidden['postponed'])) {
                 $hidden['postponed'] = 0;
             }
             $hidden['postponed']++;
         }
     }
     $show_string = $this->renderShowString($hidden);
     $view = new DifferentialResultsTableView();
     $view->setRows($rows);
     $view->setShowMoreString($show_string);
     return $view->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:68,代码来源:DifferentialLintFieldSpecification.php


示例17: renderInput

 protected function renderInput()
 {
     if (!$this->object) {
         throw new PhutilInvalidStateException('setPolicyObject');
     }
     if (!$this->capability) {
         throw new PhutilInvalidStateException('setCapability');
     }
     $policy = $this->object->getPolicy($this->capability);
     if (!$policy) {
         // TODO: Make this configurable.
         $policy = PhabricatorPolicies::POLICY_USER;
     }
     if (!$this->getValue()) {
         $this->setValue($policy);
     }
     $control_id = celerity_generate_unique_node_id();
     $input_id = celerity_generate_unique_node_id();
     $caret = phutil_tag('span', array('class' => 'caret'));
     $input = phutil_tag('input', array('type' => 'hidden', 'id' => $input_id, 'name' => $this->getName(), 'value' => $this->getValue()));
     $options = $this->getOptions();
     $order = array();
     $labels = array();
     foreach ($options as $key => $values) {
         $order[$key] = array_keys($values);
         $labels[$key] = PhabricatorPolicyType::getPolicyTypeName($key);
     }
     $flat_options = array_mergev($options);
     $icons = array();
     foreach (igroup($flat_options, 'icon') as $icon => $ignored) {
         $icons[$icon] = id(new PHUIIconView())->setIconFont($icon);
     }
     if ($this->templatePHIDType) {
         $context_path = 'template/' . $this->templatePHIDType . '/';
     } else {
         $object_phid = $this->object->getPHID();
         if ($object_phid) {
             $context_path = 'object/' . $object_phid . '/';
         } else {
             $object_type = phid_get_type($this->object->generatePHID());
             $context_path = 'type/' . $object_type . '/';
         }
     }
     Javelin::initBehavior('policy-control', array('controlID' => $control_id, 'inputID' => $input_id, 'options' => $flat_options, 'groups' => array_keys($options), 'order' => $order, 'icons' => $icons, 'labels' => $labels, 'value' => $this->getValue(), 'capability' => $this->capability, 'editURI' => '/policy/edit/' . $context_path, 'customPlaceholder' => $this->getCustomPolicyPlaceholder(), 'disabled' => $this->getDisabled()));
     $selected = idx($flat_options, $this->getValue(), array());
     $selected_icon = idx($selected, 'icon');
     $selected_name = idx($selected, 'name');
     $spaces_control = $this->buildSpacesControl();
     return phutil_tag('div', array(), array($spaces_control, javelin_tag('a', array('class' => 'grey button dropdown has-icon policy-control', 'href' => '#', 'mustcapture' => true, 'sigil' => 'policy-control', 'id' => $control_id), array($caret, javelin_tag('span', array('sigil' => 'policy-label', 'class' => 'phui-button-text'), array(idx($icons, $selected_icon), $selected_name)))), $input));
     return AphrontFormSelectControl::renderSelectTag($this->getValue(), $this->getOptions(), array('name' => $this->getName(), 'disabled' => $this->getDisabled() ? 'disabled' : null, 'id' => $this->getID()));
 }
开发者ID:mduan,项目名称:phabricator,代码行数:51,代码来源:AphrontFormPolicyControl.php


示例18: loadActualSchema


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ihtmlspecialchars函数代码示例发布时间:2022-05-15
下一篇:
PHP ignore_user_abort函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap