Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / differential / mail / DifferentialChangeDetailMailView.php
blob1f0eac537e5381785a6d58aafbde74cb8d4768bd
1 <?php
3 final class DifferentialChangeDetailMailView
4 extends DifferentialMailView {
6 private $viewer;
7 private $diff;
8 private $patch;
10 public function setViewer(PhabricatorUser $viewer) {
11 $this->viewer = $viewer;
12 return $this;
15 public function getViewer() {
16 return $this->viewer;
19 public function setDiff(DifferentialDiff $diff) {
20 $this->diff = $diff;
21 return $this;
24 public function getDiff() {
25 return $this->diff;
28 public function setPatch($patch) {
29 $this->patch = $patch;
30 return $this;
33 public function getPatch() {
34 return $this->patch;
37 public function buildMailSection() {
38 $viewer = $this->getViewer();
40 $diff = $this->getDiff();
42 $engine = new PhabricatorMarkupEngine();
43 $viewstate = new PhabricatorChangesetViewState();
45 $out = array();
46 foreach ($diff->getChangesets() as $changeset) {
47 $parser = id(new DifferentialChangesetParser())
48 ->setViewer($viewer)
49 ->setViewState($viewstate)
50 ->setChangeset($changeset)
51 ->setLinesOfContext(2)
52 ->setMarkupEngine($engine);
54 $parser->setRenderer(new DifferentialChangesetOneUpMailRenderer());
55 $block = $parser->render();
57 $filename = $changeset->getFilename();
58 $filename = $this->renderHeaderBold($filename);
59 $header = $this->renderHeaderBlock($filename);
61 $out[] = $this->renderContentBox(
62 array(
63 $header,
64 $this->renderCodeBlock($block),
65 ));
68 $out = phutil_implode_html(phutil_tag('br'), $out);
70 $patch_html = $out;
72 $patch_text = $this->getPatch();
74 return id(new PhabricatorMetaMTAMailSection())
75 ->addPlaintextFragment($patch_text)
76 ->addHTMLFragment($patch_html);