Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
35 | 66 | public function __toString(): string |
|
36 | { |
||
37 | 66 | $encoded = new OptimalTransferEncodedTextStream($this->value, 68, self::FOLDING); |
|
38 | |||
39 | 66 | $encoding = $encoded->getMetadata(['transfer-encoding'])['transfer-encoding']; |
|
40 | 66 | if ($encoding === '7bit' || $encoding === '8bit') { |
|
41 | 63 | return (string) $encoded; |
|
42 | } |
||
43 | |||
44 | 5 | if ($encoding === 'base64') { |
|
45 | 4 | return sprintf('=?%s?B?%s?=', 'UTF-8', (string) $encoded); |
|
46 | } |
||
47 | |||
48 | 1 | return sprintf('=?%s?Q?%s?=', 'UTF-8', (string) $encoded); |
|
49 | } |
||
50 | |||
51 | } |