Conditions | 5 |
Paths | 8 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function isGranted(string $ipAddress, array $places): bool |
||
33 | { |
||
34 | try { |
||
35 | foreach ($places as $place) { |
||
36 | $state = $place->getState(); |
||
37 | |||
38 | if ($state === $this->reader->getState($ipAddress)) { |
||
39 | return false; |
||
40 | } |
||
41 | |||
42 | $country = $place->getCountry(); |
||
43 | |||
44 | if ($country === $this->reader->getCountry($ipAddress)) { |
||
45 | return false; |
||
46 | } |
||
47 | } |
||
48 | |||
49 | return true; |
||
50 | } catch (AddressNotFoundException $e) { |
||
51 | return true; |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 |