1 | <?php |
||
10 | class SingleByteStringManipulation extends AbstractConvertor |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | 80 | public function getMatchers(): array |
|
25 | |||
26 | /** |
||
27 | * Convert a call to concat() |
||
28 | * |
||
29 | * @param string $expr1 First argument |
||
30 | * @param string $expr2 All other comma-separated arguments, starting with a comma |
||
31 | * @return string |
||
32 | */ |
||
33 | 4 | public function parseConcat($expr1, $expr2 = null) |
|
43 | |||
44 | /** |
||
45 | * Convert a call to normalize-space() |
||
46 | * |
||
47 | * @param string $expr |
||
48 | * @return string |
||
49 | */ |
||
50 | 1 | public function parseNormalizeSpace($expr) |
|
54 | |||
55 | /** |
||
56 | * Convert a call to substring-after() where the second argument is a literal string |
||
57 | * |
||
58 | * @param string $expr |
||
59 | * @param string $str |
||
60 | * @return string |
||
61 | */ |
||
62 | 1 | public function parseSubstringAfter($expr, $str) |
|
66 | |||
67 | /** |
||
68 | * Convert a call to substring-before() |
||
69 | * |
||
70 | * @param string $expr1 |
||
71 | * @param string $expr2 |
||
72 | * @return string |
||
73 | */ |
||
74 | 2 | public function parseSubstringBefore($expr1, $expr2) |
|
78 | |||
79 | /** |
||
80 | * Convert a call to translate() where the second and third arguments are literal strings |
||
81 | * |
||
82 | * @param string $expr |
||
83 | * @param string $from |
||
84 | * @param string $to |
||
85 | * @return string |
||
86 | */ |
||
87 | 2 | public function parseTranslate($expr, $from, $to) |
|
111 | |||
112 | /** |
||
113 | * Test whether given list of strings contains only single ASCII characters |
||
114 | * |
||
115 | * @param string[] $chars |
||
116 | * @return bool |
||
117 | */ |
||
118 | 2 | protected function isAsciiChars(array $chars) |
|
122 | |||
123 | /** |
||
124 | * Serialize a list of ASCII chars into a single PHP string |
||
125 | * |
||
126 | * @param string[] $chars |
||
127 | * @return string |
||
128 | */ |
||
129 | 1 | protected function serializeAsciiChars(array $chars) |
|
133 | |||
134 | /** |
||
135 | * Serialize the lists of characters to replace with strtr() |
||
136 | * |
||
137 | * @param string[] $from |
||
138 | * @param string[] $to |
||
139 | * @return string |
||
140 | */ |
||
141 | 1 | protected function serializeMap(array $from, array $to) |
|
151 | |||
152 | /** |
||
153 | * Split individual characters from given literal string |
||
154 | * |
||
155 | * @param string $string Original string, including quotes |
||
156 | * @return string[] |
||
157 | */ |
||
158 | 2 | protected function splitStringChars($string) |
|
164 | } |