| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.072 |
| Changes | 0 | ||
| 1 | <?php |
||
| 57 | 2 | private function concreteValidate(string $received, string $regex): bool |
|
| 58 | { |
||
| 59 | 2 | $matches = []; |
|
| 60 | |||
| 61 | 2 | $result = preg_match($regex, $received, $matches); |
|
| 62 | |||
| 63 | 2 | if ($result === 0) { |
|
| 64 | 1 | $this->message = "Received value must match regex {$regex}"; |
|
| 65 | 1 | return true; |
|
| 66 | } |
||
| 67 | |||
| 68 | 1 | if ($result === false) { |
|
|
|
|||
| 69 | $this->message = "Invalid regex provided {$regex}"; |
||
| 70 | return true; |
||
| 71 | } |
||
| 72 | |||
| 73 | 1 | return false; |
|
| 74 | } |
||
| 86 |