1 | <?php |
||
8 | class StringUtility |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | private static $iconvMap = [ |
||
14 | TransformationFormat::EIGHT => 'UTF-8', |
||
15 | TransformationFormat::SIXTEEN => 'UTF-16', |
||
16 | TransformationFormat::SIXTEEN_BIG_ENDIAN => 'UTF-16BE', |
||
17 | TransformationFormat::SIXTEEN_LITTLE_ENDIAN => 'UTF-16LE', |
||
18 | TransformationFormat::THIRTY_TWO => 'UTF-32', |
||
19 | TransformationFormat::THIRTY_TWO_BIG_ENDIAN => 'UTF-32BE', |
||
20 | TransformationFormat::THIRTY_TWO_LITTLE_ENDIAN => 'UTF-32LE' |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * @param string $string |
||
25 | * @param TransformationFormat $from |
||
26 | * @param TransformationFormat $to |
||
27 | * @return string |
||
28 | */ |
||
29 | public static function convertString($string, TransformationFormat $from, TransformationFormat $to) |
||
40 | |||
41 | /** |
||
42 | * @param string $character |
||
43 | * @param TransformationFormat $from |
||
44 | * @param TransformationFormat $to |
||
45 | * @throws InvalidArgumentException |
||
46 | * @return string |
||
47 | */ |
||
48 | public static function convertCharacter($character, TransformationFormat $from, TransformationFormat $to) |
||
58 | |||
59 | /** |
||
60 | * @param TransformationFormat $format |
||
61 | * @return string |
||
62 | * @throws InvalidArgumentException |
||
63 | */ |
||
64 | private static function mapFormat(TransformationFormat $format) |
||
72 | |||
73 | /** |
||
74 | * @param string $string |
||
75 | * @param TransformationFormat $format |
||
76 | * @return string[] |
||
77 | * @throws InvalidArgumentException |
||
78 | */ |
||
79 | public static function split($string, TransformationFormat $format) |
||
91 | } |