1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-27 23:18:20 +01:00
phorge-phorge/src/applications/metamta/view/PhabricatorMetaMTAMailSection.php
Joshua Spence b6d745b666 Extend from Phobject
Summary: All classes should extend from some other class. See D13275 for some explanation.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13283
2015-06-15 18:02:27 +10:00

39 lines
883 B
PHP

<?php
/**
* Helper for building a rendered section.
*
* @task compose Composition
* @task render Rendering
* @group metamta
*/
final class PhabricatorMetaMTAMailSection extends Phobject {
private $plaintextFragments = array();
private $htmlFragments = array();
public function getHTML() {
return $this->htmlFragments;
}
public function getPlaintext() {
return implode("\n", $this->plaintextFragments);
}
public function addHTMLFragment($fragment) {
$this->htmlFragments[] = $fragment;
return $this;
}
public function addPlaintextFragment($fragment) {
$this->plaintextFragments[] = $fragment;
return $this;
}
public function addFragment($fragment) {
$this->plaintextFragments[] = $fragment;
$this->htmlFragments[] =
phutil_escape_html_newlines(phutil_tag('div', array(), $fragment));
return $this;
}
}