Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/view/PhabricatorMetaMTAMailSection.php
- This file was added.
<?php | |||||
/** | |||||
* Helper for building a rendered section. | |||||
* | |||||
* @task compose Composition | |||||
* @task render Rendering | |||||
* @group metamta | |||||
*/ | |||||
final class PhabricatorMetaMTAMailSection { | |||||
private $plaintextFragments = array(); | |||||
private $htmlFragments = array(); | |||||
public function getHTML() { | |||||
return $this->htmlFragments; | |||||
} | |||||
epriestley: Just return `$this->htmlFragments`. | |||||
public function getPlaintext() { | |||||
return implode("\n", $this->plaintextFragments); | |||||
} | |||||
Not Done Inline ActionsA \n inside single quotes is not a newline in PHP, it's a literal backslash + n. epriestley: A `\n` inside single quotes is not a newline in PHP, it's a literal backslash + n. | |||||
Not Done Inline ActionsI totally should've written test cases for this class. talshiri: I totally should've written test cases for this class. | |||||
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; | |||||
} | |||||
} |
Just return $this->htmlFragments.