Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| CharsetAwareTrait | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| setContentType | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getCharSet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCharSet | |
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 | * Restores AbstractMessage's charset/content-type field concept on top of |
| 16 | * Pop\Mime\Part, which only models Content-Type as a header. |
| 17 | */ |
| 18 | trait CharsetAwareTrait |
| 19 | { |
| 20 | |
| 21 | protected ?string $charSet = null; |
| 22 | |
| 23 | public function setContentType(string $contentType): static |
| 24 | { |
| 25 | $this->addHeader('Content-Type', $contentType); |
| 26 | return $this; |
| 27 | } |
| 28 | |
| 29 | public function getCharSet(): ?string |
| 30 | { |
| 31 | return $this->charSet; |
| 32 | } |
| 33 | |
| 34 | public function setCharSet(?string $charSet = null): static |
| 35 | { |
| 36 | $this->charSet = $charSet; |
| 37 | return $this; |
| 38 | } |
| 39 | |
| 40 | } |