PHP Class Pop\Geo\Geo

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$databases string Array of available databases
$host string Host name to look up
$hostInfo array Host info
$latitude string Latitude value
$longitude string Longitude value

Public Methods

Method Description
__construct ( array $options = [] ) : Geo Constructor
__get ( string $name ) : mixed Get method to return the value of hostInfo[$name].
calculateDistance ( array $origin, array $destination, integer $round = 2, boolean $km = false ) : mixed Method to calculate the distance between 2 sets of coordinate
distanceTo ( Geo $dest, integer $round = 2, boolean $km = false ) : mixed Get distance from current Geo object coordinates to another
getDatabases ( ) : array Get all available databases
getHostInfo ( ) : array Get host info
getLatitude ( ) : string Get latitude
getLongitude ( ) : string Get longitude
isDbAvailable ( string $name ) : boolean Get an available database

Protected Methods

Method Description
getAvailableDatabases ( ) : void Get available databases
getGeoIpHostInfo ( ) : void Get GeoIp host information

Method Details

__construct() public method

Instantiate the Geo object.
public __construct ( array $options = [] ) : Geo
$options array
return Geo

__get() public method

Get method to return the value of hostInfo[$name].
public __get ( string $name ) : mixed
$name string
return mixed

calculateDistance() public static method

Method to calculate the distance between 2 sets of coordinate
public static calculateDistance ( array $origin, array $destination, integer $round = 2, boolean $km = false ) : mixed
$origin array
$destination array
$round integer
$km boolean
return mixed

distanceTo() public method

Get distance from current Geo object coordinates to another
public distanceTo ( Geo $dest, integer $round = 2, boolean $km = false ) : mixed
$dest Geo
$round integer
$km boolean
return mixed

getAvailableDatabases() protected method

Get available databases
protected getAvailableDatabases ( ) : void
return void

getDatabases() public method

Get all available databases
public getDatabases ( ) : array
return array

getGeoIpHostInfo() protected method

Get GeoIp host information
protected getGeoIpHostInfo ( ) : void
return void

getHostInfo() public method

Get host info
public getHostInfo ( ) : array
return array

getLatitude() public method

Get latitude
public getLatitude ( ) : string
return string

getLongitude() public method

Get longitude
public getLongitude ( ) : string
return string

isDbAvailable() public method

Get an available database
public isDbAvailable ( string $name ) : boolean
$name string
return boolean

Property Details

$databases protected property

Array of available databases
protected string $databases
return string

$host protected property

Host name to look up
protected string $host
return string

$hostInfo protected property

Host info
protected array $hostInfo
return array

$latitude protected property

Latitude value
protected string $latitude
return string

$longitude protected property

Longitude value
protected string $longitude
return string