| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function check($value): bool |
||
| 33 | { |
||
| 34 | if (! empty($code = $this->parameter('code'))) { |
||
| 35 | try { |
||
| 36 | $passes = (new CountryPhoneCallback($value, $code))->callPhoneValidator(); |
||
| 37 | } catch (BadMethodCallException) { |
||
| 38 | $code = $this->getAttribute()->getValue($code); |
||
| 39 | $passes = (new CountryPhoneCallback($value, $code))->callPhoneValidator(); |
||
|
|
|||
| 40 | } |
||
| 41 | |||
| 42 | return Helpers::collect($passes)->some(fn ($passe) => $passe); |
||
| 43 | } |
||
| 44 | |||
| 45 | return preg_match('/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/', $value); |
||
| 46 | } |
||
| 48 |