You are here

public function GeoIpHandlerV2::__construct in GeoIP API 7.2

Load the required library.

Does its best to find a library to use.

Throws

\Exception

File

src/GeoIpHandlerV2.php, line 44
The GeoIP API handler for version 2.

Class

GeoIpHandlerV2

Namespace

Drupal\geoip

Code

public function __construct() {

  // Load the required library, throw Exception on failure.
  if (($library = libraries_load('GeoIP2-php')) && empty($library['loaded'])) {
    if (($library = libraries_load('GeoIP2-phar')) && empty($library['loaded'])) {
      throw new \Exception('Unable to load GeoIP2 API.');
    }
  }
}