PHP Class Stevebauman\Location\Location

Author: Steve Bauman ([email protected])
Datei anzeigen Open project: stevebauman/location Class Usage Examples

Protected Properties

Property Type Description
$driver Stevebauman\Location\Drivers\Driver The current driver.
$key string The session key.

Public Methods

Method Description
__construct ( ) Constructor.
get ( string $ip = '' ) : Position | boolean Retrieve the users location.
setDefaultDriver ( ) Sets the default driver from the configuration.
setDriver ( Driver $driver ) Creates the selected driver instance and sets the driver property.
setSessionKey ( string $key ) : Location Sets the location session key.

Protected Methods

Method Description
getClientIP ( ) : string Returns the client IP address. Will return the set config IP if localhost testing is set to true.
getDefaultDriver ( ) : Illuminate\Support\Facades\Config Returns the selected driver
getDriver ( string $driver ) : Driver Returns the specified driver.
getDriverFallbacks ( ) : array Retrieves the config option for select driver fallbacks.
getLocalHostTestingIp ( ) : string Retrieves the config option for the localhost testing IP.
localHostTesting ( ) : boolean Retrieves the config option for localhost testing.

Method Details

__construct() public method

Constructor.
public __construct ( )

get() public method

Retrieve the users location.
public get ( string $ip = '' ) : Position | boolean
$ip string
return Position | boolean

getClientIP() protected method

Returns the client IP address. Will return the set config IP if localhost testing is set to true.
protected getClientIP ( ) : string
return string

getDefaultDriver() protected method

Returns the selected driver
protected getDefaultDriver ( ) : Illuminate\Support\Facades\Config
return Illuminate\Support\Facades\Config

getDriver() protected method

Returns the specified driver.
protected getDriver ( string $driver ) : Driver
$driver string
return Stevebauman\Location\Drivers\Driver

getDriverFallbacks() protected method

Retrieves the config option for select driver fallbacks.
protected getDriverFallbacks ( ) : array
return array

getLocalHostTestingIp() protected method

Retrieves the config option for the localhost testing IP.
protected getLocalHostTestingIp ( ) : string
return string

localHostTesting() protected method

Retrieves the config option for localhost testing.
protected localHostTesting ( ) : boolean
return boolean

setDefaultDriver() public method

Sets the default driver from the configuration.
public setDefaultDriver ( )

setDriver() public method

Creates the selected driver instance and sets the driver property.
public setDriver ( Driver $driver )
$driver Stevebauman\Location\Drivers\Driver

setSessionKey() public method

Sets the location session key.
public setSessionKey ( string $key ) : Location
$key string
return Location

Property Details

$driver protected_oe property

The current driver.
protected Driver,Stevebauman\Location\Drivers $driver
return Stevebauman\Location\Drivers\Driver

$key protected_oe property

The session key.
protected string $key
return string