Méthode | Description | |
---|---|---|
__construct ( integer $enabled = self::ALL_METHODS, array $whitelists = [], mixed $source = null ) | Constructor for the class. | |
addCustomHeader ( string $header ) : |
Adds a custom header to the list. | |
getIpAddress ( mixed $source = null ) : string | Returns the IP address of the client using the given methods. | |
getValidIpAddress ( mixed $source = null ) : string | false | Returns the valid IP address or false if no valid IP address was found. | |
setSource ( $source ) : |
Sets the source data used to lookup the addresses. |
Méthode | Description | |
---|---|---|
coalesceSources ( mixed $source = null ) : mixed | Given available sources, get the first available source of IP data. | |
extractAddressFromHeaders ( array $requestHeaders, array $headers ) : string | false | Finds the first element in $headers that is present in $_SERVER and returns the IP address mapped to that value. | |
getRequestAdapter ( mixed $source ) : Vectorface\Whip\Request\RequestAdapter | Get a source/request adapter for a given source of IP data. | |
isMethodUsable ( string $key, string $ipAddress ) : boolean | Returns whether or not the given method is enabled and usable. | |
normalizeHeaderName ( string $header ) : string | Normalizes HTTP header name representations. |
public addCustomHeader ( string $header ) : |
||
$header | string | The custom header to add. |
Résultat | Returns $this. |
public getIpAddress ( mixed $source = null ) : string | ||
$source | mixed | (optional) The source data. If omitted, the class will use the value passed to Whip::setSource or fallback to $_SERVER. |
Résultat | string | Returns the IP address as a string or false if no IP address could be found. |
public getValidIpAddress ( mixed $source = null ) : string | false | ||
$source | mixed | (optional) The source data. If omitted, the class will use the value passed to Whip::setSource or fallback to $_SERVER. |
Résultat | string | false | Returns the IP address (as a string) of the client or false if no valid IP address was found. |
public setSource ( $source ) : |
||
$source | The source array. | |
Résultat | Returns $this. |