You are here

interface GeoIpHandlerInterface in GeoIP API 7.2

Hierarchy

Expanded class hierarchy of GeoIpHandlerInterface

All classes that implement GeoIpHandlerInterface

File

src/GeoIpHandlerInterface.php, line 10
The GeoIP API Interface.

Namespace

Drupal\geoip
View source
interface GeoIpHandlerInterface {

  /**
   * Set the db file to use.
   *
   * @param string $db_file
   *   Path to the db file.
   */
  public function setDbFile($db_file);

  /**
   * Returns an array of all information related the ip.
   *
   * !Attention! The array isn't unified in any way. The return will change
   * depending on which DB type / version is used.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return array
   *   Country code or FALSE on failure.
   */
  public function rawRecord($ip = NULL);

  /**
   * Returns the continent code for a given IP.
   *
   * Defaults to using the current user's IP if not specified.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   Continent code or FALSE on failure. Code is always upper case.
   */
  public function continentCode($ip = NULL);

  /**
   * Returns the continent name for a given IP.
   *
   * Defaults to using the current user's IP if not specified.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   Continent name or FALSE on failure.
   */
  public function continentName($ip = NULL);

  /**
   * Returns the ISO 3166-2 country code for a given IP.
   *
   * Defaults to using the current user's IP if not specified.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   Country code or FALSE on failure. Code is always upper case.
   */
  public function countryCode($ip = NULL);

  /**
   * Returns the country name for a given IP.
   *
   * Defaults to using the current user's IP if not specified.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   Country name or FALSE on failure.
   */
  public function countryName($ip = NULL);

  /**
   * The region code for a given IP.
   *
   * This will just return the most accurate subdivision if there are multiple
   * levels.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   The region name or FALSE on failure. Code is always upper case.
   */
  public function regionCode($ip = NULL);

  /**
   * The region name for a given IP.
   *
   * This will just return the most accurate subdivision if there are multiple
   * levels.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   The region name or FALSE on failure.
   */
  public function regionName($ip = NULL);

  /**
   * The city name for a given IP.
   *
   * Defaults to using the current user's IP if not specified.
   * This function only works with the city level database and will return
   * false in all other cases.
   *
   * @param string $ip
   *   The ip to resolve.
   *
   * @return string|FALSE
   *   The city name or FALSE on failure (e.g. the country db is used).
   */
  public function cityName($ip = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
GeoIpHandlerInterface::cityName public function The city name for a given IP. 2
GeoIpHandlerInterface::continentCode public function Returns the continent code for a given IP. 2
GeoIpHandlerInterface::continentName public function Returns the continent name for a given IP. 2
GeoIpHandlerInterface::countryCode public function Returns the ISO 3166-2 country code for a given IP. 2
GeoIpHandlerInterface::countryName public function Returns the country name for a given IP. 2
GeoIpHandlerInterface::rawRecord public function Returns an array of all information related the ip. 2
GeoIpHandlerInterface::regionCode public function The region code for a given IP. 2
GeoIpHandlerInterface::regionName public function The region name for a given IP. 2
GeoIpHandlerInterface::setDbFile public function Set the db file to use. 2