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


PHP PhabricatorMarkupEngine::summarizeSentence方法代码示例

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


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

示例1: assertSentenceSummary

 private function assertSentenceSummary($corpus, $summary)
 {
     $this->assertEqual($summary, PhabricatorMarkupEngine::summarizeSentence($corpus), pht('Summary of: %s', $corpus));
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:4,代码来源:PhabricatorMarkupEngineTestCase.php

示例2: loadResults

 public function loadResults()
 {
     $viewer = $this->getViewer();
     $raw_query = $this->getRawQuery();
     // Allow users to type "#qa" or "qa" to find "Quality Assurance".
     $raw_query = ltrim($raw_query, '#');
     $tokens = self::tokenizeString($raw_query);
     $query = id(new PhabricatorProjectQuery())->needImages(true)->needSlugs(true);
     if ($this->getPhase() == self::PHASE_PREFIX) {
         $prefix = $this->getPrefixQuery();
         $query->withNamePrefixes(array($prefix));
     } else {
         if ($tokens) {
             $query->withNameTokens($tokens);
         }
     }
     // If this is for policy selection, prevent users from using milestones.
     $for_policy = $this->getParameter('policy');
     if ($for_policy) {
         $query->withIsMilestone(false);
     }
     $for_autocomplete = $this->getParameter('autocomplete');
     $projs = $this->executeQuery($query);
     $projs = mpull($projs, null, 'getPHID');
     $must_have_cols = $this->getParameter('mustHaveColumns', false);
     if ($must_have_cols) {
         $columns = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withProjectPHIDs(array_keys($projs))->execute();
         $has_cols = mgroup($columns, 'getProjectPHID');
     } else {
         $has_cols = array_fill_keys(array_keys($projs), true);
     }
     $is_browse = $this->getIsBrowse();
     if ($is_browse && $projs) {
         // TODO: This is a little ad-hoc, but we don't currently have
         // infrastructure for bulk querying custom fields efficiently.
         $table = new PhabricatorProjectCustomFieldStorage();
         $descriptions = $table->loadAllWhere('objectPHID IN (%Ls) AND fieldIndex = %s', array_keys($projs), PhabricatorHash::digestForIndex('std:project:internal:description'));
         $descriptions = mpull($descriptions, 'getFieldValue', 'getObjectPHID');
     } else {
         $descriptions = array();
     }
     $results = array();
     foreach ($projs as $proj) {
         $phid = $proj->getPHID();
         if (!isset($has_cols[$phid])) {
             continue;
         }
         $slug = $proj->getPrimarySlug();
         if (!strlen($slug)) {
             foreach ($proj->getSlugs() as $slug_object) {
                 $slug = $slug_object->getSlug();
                 if (strlen($slug)) {
                     break;
                 }
             }
         }
         // If we're building results for the autocompleter and this project
         // doesn't have any usable slugs, don't return it as a result.
         if ($for_autocomplete && !strlen($slug)) {
             continue;
         }
         $closed = null;
         if ($proj->isArchived()) {
             $closed = pht('Archived');
         }
         $all_strings = array();
         $all_strings[] = $proj->getDisplayName();
         foreach ($proj->getSlugs() as $project_slug) {
             $all_strings[] = $project_slug->getSlug();
         }
         $all_strings = implode("\n", $all_strings);
         $proj_result = id(new PhabricatorTypeaheadResult())->setName($all_strings)->setDisplayName($proj->getDisplayName())->setDisplayType($proj->getDisplayIconName())->setURI($proj->getURI())->setPHID($phid)->setIcon($proj->getDisplayIconIcon())->setColor($proj->getColor())->setPriorityType('proj')->setClosed($closed);
         if (strlen($slug)) {
             $proj_result->setAutocomplete('#' . $slug);
         }
         $proj_result->setImageURI($proj->getProfileImageURI());
         if ($is_browse) {
             $proj_result->addAttribute($proj->getDisplayIconName());
             $description = idx($descriptions, $phid);
             if (strlen($description)) {
                 $summary = PhabricatorMarkupEngine::summarizeSentence($description);
                 $proj_result->addAttribute($summary);
             }
         }
         $results[] = $proj_result;
     }
     return $results;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:88,代码来源:PhabricatorProjectDatasource.php


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