本文整理汇总了PHP中PhabricatorApplicationTransaction::renderAsTextForDoorkeeper方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplicationTransaction::renderAsTextForDoorkeeper方法的具体用法?PHP PhabricatorApplicationTransaction::renderAsTextForDoorkeeper怎么用?PHP PhabricatorApplicationTransaction::renderAsTextForDoorkeeper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorApplicationTransaction
的用法示例。
在下文中一共展示了PhabricatorApplicationTransaction::renderAsTextForDoorkeeper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderAsTextForDoorkeeper
public function renderAsTextForDoorkeeper(DoorkeeperFeedStoryPublisher $publisher, PhabricatorFeedStory $story, array $xactions)
{
$body = parent::renderAsTextForDoorkeeper($publisher, $story, $xactions);
$inlines = array();
foreach ($xactions as $xaction) {
if ($xaction->getTransactionType() == self::TYPE_INLINE) {
$inlines[] = $xaction;
}
}
// TODO: This is a bit gross, but far less bad than it used to be. It
// could be further cleaned up at some point.
if ($inlines) {
$engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', new PhabricatorUser())->setMode(PhutilRemarkupEngine::MODE_TEXT);
$body .= "\n\n";
$body .= pht('Inline Comments');
$body .= "\n";
$changeset_ids = array();
foreach ($inlines as $inline) {
$changeset_ids[] = $inline->getComment()->getChangesetID();
}
$changesets = id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', $changeset_ids);
foreach ($inlines as $inline) {
$comment = $inline->getComment();
$changeset = idx($changesets, $comment->getChangesetID());
if (!$changeset) {
continue;
}
$filename = $changeset->getDisplayFilename();
$linenumber = $comment->getLineNumber();
$inline_text = $engine->markupText($comment->getContent());
$inline_text = rtrim($inline_text);
$body .= "{$filename}:{$linenumber} {$inline_text}\n";
}
}
return $body;
}