PHP Class TTools\OAuthRequest

Mostra file Open project: ttools/ttools

Protected Properties

Property Type Description
$boundary string
$consumerKey Application consumer key
$consumerSecret Application consumer secret
$headers array
$requestBody string
$token Request Token
$tokenSecret Request Secret
$userAgent Curl User Agent

Public Methods

Method Description
__construct ( string $consumerKey, string $consumerSecret, string $token, string $tokenSecret ) Creates the OAuthRequest object
addHeader ( string $header )
buildHeaders ( $method, $url, $params = [], $multipart = false )
getConsumerKey ( ) : string
getConsumerSecret ( ) : string
getHeaders ( ) : mixed
getRequestBody ( ) : mixed
getToken ( ) : string
getTokenSecret ( ) : string
getUserAgent ( ) : string
request ( string $method, string $url, array $params = [], boolean $multipart = false ) : OAuthResponse Performs an authenticated OAuth Request
setConsumerKey ( string $consumerKey )
setConsumerSecret ( string $consumerSecret )
setHeaders ( mixed $headers )
setRequestBody ( mixed $requestBody )
setToken ( string $token )
setTokenSecret ( string $tokenSecret )
setUserAgent ( string $userAgent )

Protected Methods

Method Description
buildMultipartContent ( $file )
curlRequest ( string $url, array $params = [], string $method = 'GET', boolean $multipart = false ) : OAuthResponse Performs a OAuth curl request.
encodeParams ( array $params = [], boolean $quoted = false ) : array Encodes parameters
formatQueryString ( array $params ) : string
getOAuthHeader ( string $method, string $url, array $params = [], boolean $multipart = false ) : string Gets the OAuth signed Authorization headers
urlencodeRfc3986 ( $input ) : array | mixed | string

Method Details

__construct() public method

Creates the OAuthRequest object
public __construct ( string $consumerKey, string $consumerSecret, string $token, string $tokenSecret )
$consumerKey string Application Consumer Key
$consumerSecret string Application Consumer Secret
$token string Request Token
$tokenSecret string Request Token Secret

addHeader() public method

public addHeader ( string $header )
$header string

buildHeaders() public method

public buildHeaders ( $method, $url, $params = [], $multipart = false )

buildMultipartContent() protected method

protected buildMultipartContent ( $file )

curlRequest() protected method

Performs a OAuth curl request.
protected curlRequest ( string $url, array $params = [], string $method = 'GET', boolean $multipart = false ) : OAuthResponse
$url string
$params array
$method string
$multipart boolean
return OAuthResponse

encodeParams() protected method

Encodes parameters
protected encodeParams ( array $params = [], boolean $quoted = false ) : array
$params array
$quoted boolean
return array

formatQueryString() protected method

protected formatQueryString ( array $params ) : string
$params array
return string

getConsumerKey() public method

public getConsumerKey ( ) : string
return string

getConsumerSecret() public method

public getConsumerSecret ( ) : string
return string

getHeaders() public method

public getHeaders ( ) : mixed
return mixed

getOAuthHeader() protected method

Gets the OAuth signed Authorization headers
protected getOAuthHeader ( string $method, string $url, array $params = [], boolean $multipart = false ) : string
$method string
$url string
$params array
$multipart boolean
return string

getRequestBody() public method

public getRequestBody ( ) : mixed
return mixed

getToken() public method

public getToken ( ) : string
return string

getTokenSecret() public method

public getTokenSecret ( ) : string
return string

getUserAgent() public method

public getUserAgent ( ) : string
return string

request() public method

Performs an authenticated OAuth Request
public request ( string $method, string $url, array $params = [], boolean $multipart = false ) : OAuthResponse
$method string Request Method (GET / POST)
$url string Request endpoint (e.g: /1.1/account/verify_credentials.json)
$params array Params for the request
$multipart boolean If the request is multipart or not (defaults to false)
return OAuthResponse Returns an OAuthResponse object

setConsumerKey() public method

public setConsumerKey ( string $consumerKey )
$consumerKey string

setConsumerSecret() public method

public setConsumerSecret ( string $consumerSecret )
$consumerSecret string

setHeaders() public method

public setHeaders ( mixed $headers )
$headers mixed

setRequestBody() public method

public setRequestBody ( mixed $requestBody )
$requestBody mixed

setToken() public method

public setToken ( string $token )
$token string

setTokenSecret() public method

public setTokenSecret ( string $tokenSecret )
$tokenSecret string

setUserAgent() public method

public setUserAgent ( string $userAgent )
$userAgent string

urlencodeRfc3986() protected method

protected urlencodeRfc3986 ( $input ) : array | mixed | string
$input
return array | mixed | string

Property Details

$boundary protected_oe property

protected string $boundary
return string

$consumerKey protected_oe property

Application consumer key
protected $consumerKey

$consumerSecret protected_oe property

Application consumer secret
protected $consumerSecret

$headers protected_oe property

protected array $headers
return array

$requestBody protected_oe property

protected string $requestBody
return string

$token protected_oe property

Request Token
protected $token

$tokenSecret protected_oe property

Request Secret
protected $tokenSecret

$userAgent protected_oe property

Curl User Agent
protected $userAgent