You are here

private function Database::readLatitudeAndLongitude in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 includes/vendor/ip2location/ip2location-php/IP2Location.php \IP2Location\Database::readLatitudeAndLongitude()

High level function to fetch the latitude and longitude

@access private

Parameters

int $pointer Position to read from, if false, return self::INVALID_IP_ADDRESS:

Return value

array

1 call to Database::readLatitudeAndLongitude()
Database::lookup in includes/vendor/ip2location/ip2location-php/IP2Location.php
This function will look the given IP address up in the database and return the result(s) asked for

File

includes/vendor/ip2location/ip2location-php/IP2Location.php, line 1201

Class

Database
IP2Location database class

Namespace

IP2Location

Code

private function readLatitudeAndLongitude($pointer) {
  if (false === $pointer) {

    // Deal with invalid IPs
    $latitude = self::INVALID_IP_ADDRESS;
    $longitude = self::INVALID_IP_ADDRESS;
  }
  elseif (0 === self::$columns[self::LATITUDE][$this->type]) {

    // If the field is not suported, return accordingly
    $latitude = self::FIELD_NOT_SUPPORTED;
    $longitude = self::FIELD_NOT_SUPPORTED;
  }
  else {

    // Read latitude and longitude
    $latitude = $this
      ->readFloat($pointer + self::$columns[self::LATITUDE][$this->type]);
    $longitude = $this
      ->readFloat($pointer + self::$columns[self::LONGITUDE][$this->type]);
  }
  return [
    $latitude,
    $longitude,
  ];
}