@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class HarbormasterMessageException extends Exception {
4
5 private $title;
6 private $body = array();
7
8 public function __construct($title, $body = null) {
9 $this->setTitle($title);
10 $this->appendParagraph($body);
11
12 parent::__construct(
13 pht(
14 '%s: %s',
15 $title,
16 $body));
17 }
18
19 public function setTitle($title) {
20 $this->title = $title;
21 return $this;
22 }
23
24 public function getTitle() {
25 return $this->title;
26 }
27
28 public function appendParagraph($description) {
29 $this->body[] = $description;
30 return $this;
31 }
32
33 public function getBody() {
34 return $this->body;
35 }
36
37 public function newDisplayString() {
38 $title = $this->getTitle();
39
40 $body = $this->getBody();
41 $body = implode("\n\n", $body);
42
43 return pht('%s: %s', $title, $body);
44 }
45
46}