private function getResultPhase(PhabricatorTypeaheadResult $result)
 {
     if ($this->prefixLength) {
         $result_name = phutil_utf8_strtolower($result->getName());
         if (!strncmp($result_name, $this->prefixString, $this->prefixLength)) {
             return self::PHASE_PREFIX;
         }
     }
     return self::PHASE_CONTENT;
 }
 private function renderBrowseResult(PhabricatorTypeaheadResult $result, $button)
 {
     $class = array();
     $style = array();
     $separator = " · ";
     $class[] = 'phabricator-main-search-typeahead-result';
     $name = phutil_tag('div', array('class' => 'result-name'), $result->getDisplayName());
     $icon = $result->getIcon();
     $icon = id(new PHUIIconView())->setIcon($icon);
     $attributes = $result->getAttributes();
     $attributes = phutil_implode_html($separator, $attributes);
     $attributes = array($icon, ' ', $attributes);
     $closed = $result->getClosed();
     if ($closed) {
         $class[] = 'result-closed';
         $attributes = array($closed, $separator, $attributes);
     }
     $attributes = phutil_tag('div', array('class' => 'result-type'), $attributes);
     $image = $result->getImageURI();
     if ($image) {
         $style[] = 'background-image: url(' . $image . ');';
         $class[] = 'has-image';
     }
     return phutil_tag('div', array('class' => implode(' ', $class), 'style' => implode(' ', $style)), array($button, $name, $attributes));
 }
 public static function newFromTypeaheadResult(PhabricatorTypeaheadResult $result)
 {
     return id(new PhabricatorTypeaheadTokenView())->setKey($result->getPHID())->setIcon($result->getIcon())->setColor($result->getColor())->setValue($result->getDisplayName())->setTokenType($result->getTokenType());
 }