| Conditions | 2 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function getFunctions() |
||
| 11 | { |
||
| 12 | return [ |
||
| 13 | new ExpressionFunction('strlen', function ($str) { |
||
| 14 | return sprintf('(is_string(%1$s) ? strlen(%1$s) : %1$s)', $str); |
||
| 15 | }, function ($arguments, $str) { |
||
| 16 | if (!is_string($str)) { |
||
| 17 | return $str; |
||
| 18 | } |
||
| 19 | |||
| 20 | return strlen($str); |
||
| 21 | }), |
||
| 22 | new ExpressionFunction('contains', function ($haystack, $needle) { |
||
| 23 | return sprintf('(strpos(%1$s, %2$s) !== false) ? true : false', $haystack, $needle); |
||
| 24 | }, function ($arguments, $haystack, $needle) { |
||
| 25 | return strpos($haystack, $needle) !== false; |
||
| 26 | }), |
||
| 30 |