Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function resolveIpLocation(string $ipAddress): array |
|
26 | { |
||
27 | 3 | $error = null; |
|
28 | |||
29 | 3 | foreach ($this->resolvers as $resolver) { |
|
30 | try { |
||
31 | 3 | return $resolver->resolveIpLocation($ipAddress); |
|
32 | 2 | } catch (WrongIpException $e) { |
|
33 | 2 | $error = $e; |
|
34 | } |
||
35 | } |
||
36 | |||
37 | // If this instruction is reached, it means no resolver was capable of resolving the address |
||
38 | 1 | throw WrongIpException::fromIpAddress($ipAddress, $error); |
|
39 | } |
||
41 |