Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function callPhoneValidator(): array |
||
33 | { |
||
34 | $results = []; |
||
35 | |||
36 | $codes = explode(',', $this->code); |
||
37 | |||
38 | $codes = array_map('strtoupper', $codes); |
||
39 | |||
40 | foreach ($codes as $code) { |
||
41 | $methodName = 'validate' . $code; |
||
42 | |||
43 | if (method_exists($this, $methodName)) { |
||
44 | $results[$code] = $this->{$methodName}(); |
||
45 | } else { |
||
46 | throw new \BadMethodCallException("Validator method '{$methodName}' does not exist."); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | return $results; |
||
51 | } |
||
53 |