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) |
||
36 | |||
37 | /** |
||
38 | * @param string $character |
||
39 | * @param TransformationFormat $from |
||
40 | * @param TransformationFormat $to |
||
41 | * @throws InvalidArgumentException |
||
42 | * @return string |
||
43 | */ |
||
44 | public static function convertCharacter($character, TransformationFormat $from, TransformationFormat $to) |
||
54 | |||
55 | /** |
||
56 | * @param TransformationFormat $format |
||
57 | * @return string |
||
58 | * @throws InvalidArgumentException |
||
59 | */ |
||
60 | private static function mapFormat(TransformationFormat $format) |
||
68 | |||
69 | /** |
||
70 | * @param string $string |
||
71 | * @param TransformationFormat $format |
||
72 | * @return string[] |
||
73 | * @throws InvalidArgumentException |
||
74 | */ |
||
75 | public static function split($string, TransformationFormat $format) |
||
87 | } |