| Total Complexity | 7 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class XffTrustProvider implements IXffTrustProvider |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Array of IP addresses which are TRUSTED proxies |
||
| 15 | * @var string[] |
||
| 16 | */ |
||
| 17 | private $trustedCache = array(); |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Array of IP addresses which are UNTRUSTED proxies |
||
| 21 | * @var string[] |
||
| 22 | */ |
||
| 23 | private $untrustedCache = array(); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Creates a new instance of the trust provider |
||
| 27 | * @param string[] $squidIpList List of IP addresses to pre-approve |
||
| 28 | */ |
||
| 29 | public function __construct($squidIpList) |
||
| 30 | { |
||
| 31 | $this->trustedCache = $squidIpList; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Returns a value if the IP address is a trusted proxy |
||
| 36 | * @param string $ip |
||
| 37 | * @param PdoDatabase $database |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | public function isTrusted($ip, PdoDatabase $database = null) |
||
| 73 | } |
||
| 74 | } |
||
| 75 |