DefaultLookupAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCountry() 0 11 2
1
<?php
2
namespace Azine\GeoBlockingBundle\Adapter;
3
4
class DefaultLookupAdapter implements GeoIpLookupAdapterInterface
5
{
6 4
    public function getCountry($visitorAddress)
7
    {
8 4
        if (!function_exists("geoip_country_code_by_name")) {
9
            // @codeCoverageIgnoreStart
10
            throw new \InvalidArgumentException("It seems, the geo-ip extension is not installed for php.");
11
            // @codeCoverageIgnoreEnd
12
        }
13 4
        $counrtyCode = @\geoip_country_code_by_name($visitorAddress);
14
15 4
        return $counrtyCode;
16
    }
17
}
18