| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 1 | public function validate($attribute, $value, $parameters, $validator): bool |
|
| 27 | { |
||
| 28 | 1 | $phoneNumbers = collect(explode(',', $value)); |
|
| 29 | |||
| 30 | 1 | $invalidNumbers = []; |
|
| 31 | |||
| 32 | 1 | foreach ($phoneNumbers as $phoneNumber) { |
|
| 33 | 1 | $proto = $this->sanitiser->getPhoneNumberObject($phoneNumber); |
|
| 34 | |||
| 35 | 1 | if (!$proto || |
|
| 36 | 1 | !in_array( |
|
| 37 | 1 | $this->sanitiser->getRegionCodeForNumber($proto), |
|
| 38 | 1 | config('digitonic.validation.allowed_mobile_origins') |
|
| 39 | ) |
||
| 40 | ) { |
||
| 41 | 1 | $invalidNumbers[] = $phoneNumber; |
|
| 42 | } |
||
| 43 | |||
| 44 | } |
||
| 45 | |||
| 46 | 1 | return count($invalidNumbers) === 0; |
|
| 47 | } |
||
| 48 | } |
||
| 49 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.