Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait WithStringHelpers |
||
9 | { |
||
10 | /** |
||
11 | * This helper method re-encodes an ISO 8859-1 string to UTF-8. |
||
12 | * |
||
13 | * @see https://en.wikipedia.org/wiki/ISO/IEC_8859-1 |
||
14 | * @see https://en.wikipedia.org/wiki/UTF-8 |
||
15 | * |
||
16 | * @param string $value The ISO 8859-1 encoded string. |
||
17 | * @return string The UTF-8 encoded string. |
||
18 | */ |
||
19 | protected static function isoToUtf8(string $value): string |
||
20 | { |
||
21 | return iconv('ISO-8859-1', 'UTF-8', $value); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * This helper method re-encodes an UTF-8 string to ISO 8859-1. |
||
26 | * |
||
27 | * @see https://en.wikipedia.org/wiki/ISO/IEC_8859-1 |
||
28 | * @see https://en.wikipedia.org/wiki/UTF-8 |
||
29 | * |
||
30 | * @param string $value The UTF-8 encoded string. |
||
31 | * @return string The ISO 8859-1 encoded string. |
||
32 | */ |
||
33 | protected static function utf8ToIso(string $value): string |
||
36 | } |
||
37 | } |