Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| PartContentTrait | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| setContent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| renderAsLines | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | /** |
| 4 | * Pop PHP Framework (https://www.popphp.org/) |
| 5 | * |
| 6 | * @link https://github.com/popphp/popphp-framework |
| 7 | * @author Nick Sagona, III <dev@noladev.com> |
| 8 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 9 | * @license https://www.popphp.org/license New BSD License |
| 10 | */ |
| 11 | |
| 12 | namespace Pop\Mail\Message; |
| 13 | |
| 14 | /** |
| 15 | * Adds getContent()/setContent() convenience accessors on top of |
| 16 | * Pop\Mime\Part, which has no direct equivalents. |
| 17 | */ |
| 18 | trait PartContentTrait |
| 19 | { |
| 20 | |
| 21 | public function getContent(): ?string |
| 22 | { |
| 23 | return $this->hasBody() ? $this->getBody()->getContent() : null; |
| 24 | } |
| 25 | |
| 26 | public function setContent(string $content): static |
| 27 | { |
| 28 | $this->setBody($content); |
| 29 | return $this; |
| 30 | } |
| 31 | |
| 32 | public function renderAsLines(): array |
| 33 | { |
| 34 | $lines = explode("\r\n", $this->render()); |
| 35 | return array_map('trim', $lines); |
| 36 | } |
| 37 | |
| 38 | } |