1 | <?php |
||
23 | class Ip implements Whitelist |
||
24 | { |
||
25 | /** |
||
26 | * @var \OpCacheGUI\Network\Ip\Converter[] List of address to range converters |
||
27 | */ |
||
28 | private $converters = []; |
||
29 | |||
30 | /** |
||
31 | * @var array List of whitelist ranges |
||
32 | */ |
||
33 | private $whitelists = []; |
||
34 | |||
35 | /** |
||
36 | * Creates instance |
||
37 | * |
||
38 | * @param \OpCacheGUI\Network\Ip\Converter[] $converters List of address to range converters |
||
39 | */ |
||
40 | 7 | public function __construct(array $converters) |
|
44 | |||
45 | /** |
||
46 | * Builds the whitelist |
||
47 | * |
||
48 | * @param array $addresses List of addresses which form the whitelist |
||
49 | */ |
||
50 | 6 | public function buildWhitelist(array $addresses) |
|
56 | |||
57 | /** |
||
58 | * Adds a range to the whitelist |
||
59 | * |
||
60 | * @param string $address The address(range) to add to the whitelist |
||
61 | */ |
||
62 | 5 | private function addWhitelist($address) |
|
72 | |||
73 | /** |
||
74 | * Checks whether the ip is allowed access |
||
75 | * |
||
76 | * @param string $ip The IP address to check |
||
77 | * |
||
78 | * @return boolean True when the IP is allowed access |
||
79 | */ |
||
80 | 2 | public function isAllowed($ip) |
|
92 | } |
||
93 |