PHP Class VCR\Request

Inheritance: extends Guzzle\Http\Message\EntityEnclosingRequest
Exibir arquivo Open project: php-vcr/php-vcr Class Usage Examples

Protected Properties

Property Type Description
$body string
$curlOptions array
$headers array
$method string
$postFields array
$postFiles array
$url string

Public Methods

Method Description
__construct ( string $method, string $url, array $headers = [] )
addPostFile ( array $file )
fromArray ( array $request ) : Request Creates a new Request from a specified array.
getBody ( ) : string
getCurlOption ( $key ) : mixed
getCurlOptions ( ) : array
getHeader ( $key ) : mixed
getHeaders ( ) : array
getHost ( ) : mixed
getMethod ( ) : string
getPath ( ) : mixed
getPostFields ( ) : array
getPostFiles ( ) : array
getQuery ( ) : mixed
getUrl ( ) : string
matches ( Request $request, array $requestMatchers ) : boolean Returns true if specified request matches the current one with specified request matcher callbacks.
removeHeader ( $key )
setAuthorization ( string $username, string $password ) Sets the authorization credentials as header.
setBody ( string $body )
setCurlOption ( $key, $value )
setCurlOptions ( array $curlOptions )
setHeader ( $key, $value )
setMethod ( string $method ) Sets the request method.
setPostField ( $key, $value )
setPostFields ( array $post_fields )
setPostFiles ( array $post_files )
setUrl ( string $url )
toArray ( ) : array Returns an array representation of this request.

Method Details

__construct() public method

public __construct ( string $method, string $url, array $headers = [] )
$method string
$url string
$headers array

addPostFile() public method

public addPostFile ( array $file )
$file array

fromArray() public static method

Creates a new Request from a specified array.
public static fromArray ( array $request ) : Request
$request array Request represented as an array.
return Request A new Request from specified array.

getBody() public method

public getBody ( ) : string
return string

getCurlOption() public method

public getCurlOption ( $key ) : mixed
$key
return mixed

getCurlOptions() public method

public getCurlOptions ( ) : array
return array

getHeader() public method

public getHeader ( $key ) : mixed
$key
return mixed

getHeaders() public method

public getHeaders ( ) : array
return array

getHost() public method

public getHost ( ) : mixed
return mixed

getMethod() public method

public getMethod ( ) : string
return string

getPath() public method

public getPath ( ) : mixed
return mixed

getPostFields() public method

public getPostFields ( ) : array
return array

getPostFiles() public method

public getPostFiles ( ) : array
return array

getQuery() public method

public getQuery ( ) : mixed
return mixed

getUrl() public method

public getUrl ( ) : string
return string

matches() public method

Returns true if specified request matches the current one with specified request matcher callbacks.
public matches ( Request $request, array $requestMatchers ) : boolean
$request Request Request to check if it matches the current one.
$requestMatchers array Request matcher callbacks.
return boolean True if specified request matches the current one.

removeHeader() public method

public removeHeader ( $key )
$key

setAuthorization() public method

Sets the authorization credentials as header.
public setAuthorization ( string $username, string $password )
$username string Username.
$password string Password.

setBody() public method

public setBody ( string $body )
$body string

setCurlOption() public method

public setCurlOption ( $key, $value )
$key
$value

setCurlOptions() public method

public setCurlOptions ( array $curlOptions )
$curlOptions array

setHeader() public method

public setHeader ( $key, $value )
$key
$value

setMethod() public method

Sets the request method.
public setMethod ( string $method )
$method string HTTP request method like GET, POST, PUT, ...

setPostField() public method

public setPostField ( $key, $value )
$key
$value

setPostFields() public method

public setPostFields ( array $post_fields )
$post_fields array

setPostFiles() public method

public setPostFiles ( array $post_files )
$post_files array

setUrl() public method

public setUrl ( string $url )
$url string

toArray() public method

Returns an array representation of this request.
public toArray ( ) : array
return array Array representation of this request.

Property Details

$body protected_oe property

protected string $body
return string

$curlOptions protected_oe property

protected array $curlOptions
return array

$headers protected_oe property

protected array $headers
return array

$method protected_oe property

protected string $method
return string

$postFields protected_oe property

protected array $postFields
return array

$postFiles protected_oe property

protected array $postFiles
return array

$url protected_oe property

protected string $url
return string