Total Complexity | 6 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class GeoIP2Country |
||
8 | { |
||
9 | /** |
||
10 | * PDO SQLite3 database instance |
||
11 | * |
||
12 | * @var GeoipDatabase |
||
13 | **/ |
||
14 | private $oDBInstance=null; |
||
15 | /** |
||
16 | * Network tools class instance |
||
17 | * |
||
18 | * @var GeoipNetwork |
||
19 | **/ |
||
20 | private $oNetwork=null; |
||
21 | /** |
||
22 | * Class Constructor |
||
23 | * |
||
24 | * @param string $database |
||
25 | */ |
||
26 | public function __construct(string $database = null) |
||
27 | { |
||
28 | $this->oDBInstance = new GeoipDatabase($database); |
||
29 | $this->oNetwork = new GeoipNetwork(); |
||
30 | return $this; |
||
31 | } |
||
32 | /** |
||
33 | * Retrieve country code from given IP address |
||
34 | * |
||
35 | * @param string|null $ipAddress |
||
36 | * @return string |
||
37 | */ |
||
38 | public function resolve(string $ipAddress= null): string |
||
39 | { |
||
40 | $ipAddress || $ipAddress = $this->oNetwork->getIPAddress(); |
||
41 | $ipVersion = $this->oNetwork->ipVersion($ipAddress); |
||
42 | $start = $this->oNetwork->ip2Integer($ipAddress); |
||
43 | return $this->oDBInstance->fetch($start, $ipVersion); |
||
44 | } |
||
45 | /** |
||
46 | * @param mixed|null $ipAddress |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function isReservedAddress($ipAddress=null): bool |
||
54 | } |
||
55 | } |
||
56 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths