public function getTitle()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created this badge.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s renamed this badge from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
             }
             break;
         case self::TYPE_FLAVOR:
             if ($old === null) {
                 return pht('%s set the flavor text for this badge.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s updated the flavor text for this badge.', $this->renderHandleLink($author_phid));
             }
             break;
         case self::TYPE_DESCRIPTION:
             if ($old === null) {
                 return pht('%s set the description for this badge.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s updated the description for this badge.', $this->renderHandleLink($author_phid));
             }
             break;
         case self::TYPE_ICON:
             if ($old === null) {
                 return pht('%s set the icon for this badge as "%s".', $this->renderHandleLink($author_phid), $new);
             } else {
                 $icon_map = PhabricatorBadgesBadge::getIconNameMap();
                 $icon_new = idx($icon_map, $new, $new);
                 $icon_old = idx($icon_map, $old, $old);
                 return pht('%s updated the icon for this badge from "%s" to "%s".', $this->renderHandleLink($author_phid), $icon_old, $icon_new);
             }
             break;
         case self::TYPE_QUALITY:
             if ($old === null) {
                 return pht('%s set the quality for this badge as "%s".', $this->renderHandleLink($author_phid), $new);
             } else {
                 $qual_map = PhabricatorBadgesBadge::getQualityNameMap();
                 $qual_new = idx($qual_map, $new, $new);
                 $qual_old = idx($qual_map, $old, $old);
                 return pht('%s updated the quality for this badge from "%s" to "%s".', $this->renderHandleLink($author_phid), $qual_old, $qual_new);
             }
             break;
     }
     return parent::getTitle();
 }
 private function buildDetailsView(PhabricatorBadgesBadge $badge)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $quality = idx($badge->getQualityNameMap(), $badge->getQuality());
     $view->addProperty(pht('Quality'), $quality);
     $view->addProperty(pht('Icon'), id(new PhabricatorBadgesIconSet())->getIconLabel($badge->getIcon()));
     $view->addProperty(pht('Flavor'), $badge->getFlavor());
     $description = $badge->getDescription();
     if (strlen($description)) {
         $view->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
         $view->addTextContent(new PHUIRemarkupView($viewer, $description));
     }
     $badge = id(new PHUIBadgeView())->setIcon($badge->getIcon())->setHeader($badge->getName())->setSubhead($badge->getFlavor())->setQuality($badge->getQuality());
     $view->addTextContent($badge);
     return $view;
 }