1 | <?php |
||
10 | class SingleByteStringFunctions extends AbstractConvertor |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | 80 | public function getMatchers(): array |
|
27 | |||
28 | /** |
||
29 | * Convert a call to contains() |
||
30 | * |
||
31 | * @param string $haystack Expression for the haystack part of the call |
||
32 | * @param string $needle Expression for the needle part of the call |
||
33 | * @return string |
||
34 | */ |
||
35 | 1 | public function parseContains($haystack, $needle) |
|
39 | |||
40 | /** |
||
41 | * Convert a call to ends-with() |
||
42 | * |
||
43 | * @param string $string Expression for the string part of the call |
||
44 | * @param string $substring Expression for the substring part of the call |
||
45 | * @return string |
||
46 | */ |
||
47 | 4 | public function parseEndsWith($string, $substring) |
|
51 | |||
52 | /** |
||
53 | * Convert a call to not(contains()) |
||
54 | * |
||
55 | * @param string $haystack Expression for the haystack part of the call |
||
56 | * @param string $needle Expression for the needle part of the call |
||
57 | * @return string |
||
58 | */ |
||
59 | 1 | public function parseNotContains($haystack, $needle) |
|
63 | |||
64 | /** |
||
65 | * Convert a call to not(ends-with()) |
||
66 | * |
||
67 | * @param string $string Expression for the string part of the call |
||
68 | * @param string $substring Expression for the substring part of the call |
||
69 | * @return string |
||
70 | */ |
||
71 | 1 | public function parseNotEndsWith($string, $substring) |
|
75 | |||
76 | /** |
||
77 | * Convert a call to not(starts-with()) |
||
78 | * |
||
79 | * @param string $string Expression for the string part of the call |
||
80 | * @param string $substring Expression for the substring part of the call |
||
81 | * @return string |
||
82 | */ |
||
83 | 1 | public function parseNotStartsWith($string, $substring) |
|
87 | |||
88 | /** |
||
89 | * Convert a call to starts-with() |
||
90 | * |
||
91 | * @param string $string Expression for the string part of the call |
||
92 | * @param string $substring Expression for the substring part of the call |
||
93 | * @return string |
||
94 | */ |
||
95 | 1 | public function parseStartsWith($string, $substring) |
|
99 | |||
100 | /** |
||
101 | * Convert a call to string-length() |
||
102 | * |
||
103 | * @param string $expr |
||
104 | * @return string |
||
105 | */ |
||
106 | 3 | public function parseStringLength($expr = '.') |
|
110 | |||
111 | /** |
||
112 | * Generate the code for a call to contains() |
||
113 | * |
||
114 | * @param string $haystack Expression for the haystack part of the call |
||
115 | * @param string $needle Expression for the needle part of the call |
||
116 | * @param bool $bool Return value for a positive match |
||
117 | * @return string |
||
118 | */ |
||
119 | 2 | protected function generateContains($haystack, $needle, $bool) |
|
125 | |||
126 | /** |
||
127 | * Generate the code for a call to ends-with() |
||
128 | * |
||
129 | * @param string $string Expression for the string part of the call |
||
130 | * @param string $substring Expression for the substring part of the call |
||
131 | * @param bool $bool Return value for a positive match |
||
132 | * @return string |
||
133 | */ |
||
134 | 5 | protected function generateEndsWith($string, $substring, $bool) |
|
140 | |||
141 | /** |
||
142 | * Generate the code for a call to ends-with() where the second argument is a literal string |
||
143 | * |
||
144 | * @param string $string Expression for the string part of the call |
||
145 | * @param string $substring Expression for a literal substring |
||
146 | * @param bool $bool Return value for a positive match |
||
147 | * @return string |
||
148 | */ |
||
149 | 4 | protected function generateEndsWithLiteral($string, $substring, $bool) |
|
155 | |||
156 | /** |
||
157 | * Generate the code for a call to ends-with() |
||
158 | * |
||
159 | * @param string $string Expression for the string part of the call |
||
160 | * @param string $substring Expression for the substring part of the call |
||
161 | * @param bool $bool Return value for a positive match |
||
162 | * @return string |
||
163 | */ |
||
164 | 1 | protected function generateEndsWithExpression($string, $substring, $bool) |
|
170 | |||
171 | /** |
||
172 | * Generate the code for a call to starts-with() |
||
173 | * |
||
174 | * @param string $string Expression for the string part of the call |
||
175 | * @param string $substring Expression for the substring part of the call |
||
176 | * @param bool $bool Return value for a positive match |
||
177 | * @return string |
||
178 | */ |
||
179 | 2 | protected function generateStartsWith($string, $substring, $bool) |
|
185 | } |