| Conditions | 5 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function isRegexLike(string $value): bool |
||
| 21 | { |
||
| 22 | $valueLength = strlen($value); |
||
| 23 | |||
| 24 | if ($valueLength < 2) { |
||
| 25 | return false; |
||
| 26 | } |
||
| 27 | |||
| 28 | $firstCharacter = $value[0]; |
||
| 29 | $lastCharacter = $value[$valueLength - 1]; |
||
| 30 | |||
| 31 | if ($firstCharacter !== $lastCharacter) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | $trimmedValue = trim($value, $firstCharacter); |
||
| 36 | |||
| 37 | if (strlen($trimmedValue) !== ($valueLength - 2)) { |
||
| 38 | return false; |
||
| 39 | } |
||
| 40 | |||
| 41 | if (str_contains($trimmedValue, $firstCharacter)) { |
||
| 42 | return false; |
||
| 43 | } |
||
| 44 | |||
| 45 | return true; |
||
| 46 | } |
||
| 61 |