PHP Class Phergie_Plugin_Url_Shorten_Abstract, phergie

Author: Phergie Development Team ([email protected])
Mostrar archivo Open project: phergie/phergie Class Usage Examples

Protected Properties

Property Type Description
$http
$minimumLength

Public Methods

Method Description
__construct ( Phergie_Plugin_Http $http ) Constructor
getMinimumLength ( ) : integer Returns the minimum length that a url must be before it is shortened by the current service.
shorten ( string $url ) : string Shortens a given url.

Protected Methods

Method Description
getRequestParams ( string $url ) : array Returns an array of request parameters given a url to shorten. The following keys are valid request parameters:

Method Details

__construct() public method

Constructor
public __construct ( Phergie_Plugin_Http $http )
$http Phergie_Plugin_Http instance of the http plugin

getMinimumLength() public method

Returns the minimum length that a url must be before it is shortened by the current service.
public getMinimumLength ( ) : integer
return integer

getRequestParams() abstract protected method

* 'uri': the URI for the request (required) * 'query': an array of key-value pairs sent in a GET request * 'post': an array of key-value pairs sent in a POST request * 'callback': to be called after the request is finished. Should accept a Phergie_Plugin_Http_Response object and return either the shortened url or false if an error has occured. If the 'post' key is present a POST request shall be made; otherwise a GET request will be made. The 'post' key can be an empty array and a post request will still be made. If no callback is provided the contents of the response will be returned.
abstract protected getRequestParams ( string $url ) : array
$url string the url to shorten
return array the request parameters

shorten() public method

Shortens a given url.
public shorten ( string $url ) : string
$url string the url to shorten
return string the shortened url or false on a failure

Property Details

$http protected_oe property

protected $http

$minimumLength protected_oe property

protected $minimumLength