PHP Class GuzzleHttp\Handler\MockHandler

Inheritance: implements Countable
ファイルを表示 Open project: guzzle/guzzle Class Usage Examples

Public Methods

Method Description
__construct ( array $queue = null, callable $onFulfilled = null, callable $onRejected = null ) The passed in value must be an array of {@see Psr7\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises.
__invoke ( Psr\Http\Message\RequestInterface $request, array $options )
append ( ) Adds one or more variadic requests, exceptions, callables, or promises to the queue.
count ( ) : integer Returns the number of remaining items in the queue.
createWithMiddleware ( array $queue = null, callable $onFulfilled = null, callable $onRejected = null ) : GuzzleHttp\HandlerStack Creates a new MockHandler that uses the default handler stack list of middlewares.
getLastOptions ( ) : array Get the last received request options.
getLastRequest ( ) : Psr\Http\Message\RequestInterface Get the last received request.

Private Methods

Method Description
invokeStats ( Psr\Http\Message\RequestInterface $request, array $options, Psr\Http\Message\ResponseInterface $response = null, $reason = null )

Method Details

__construct() public method

The passed in value must be an array of {@see Psr7\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises.
public __construct ( array $queue = null, callable $onFulfilled = null, callable $onRejected = null )
$queue array
$onFulfilled callable Callback to invoke when the return value is fulfilled.
$onRejected callable Callback to invoke when the return value is rejected.

__invoke() public method

public __invoke ( Psr\Http\Message\RequestInterface $request, array $options )
$request Psr\Http\Message\RequestInterface
$options array

append() public method

Adds one or more variadic requests, exceptions, callables, or promises to the queue.
public append ( )

count() public method

Returns the number of remaining items in the queue.
public count ( ) : integer
return integer

createWithMiddleware() public static method

Creates a new MockHandler that uses the default handler stack list of middlewares.
public static createWithMiddleware ( array $queue = null, callable $onFulfilled = null, callable $onRejected = null ) : GuzzleHttp\HandlerStack
$queue array Array of responses, callables, or exceptions.
$onFulfilled callable Callback to invoke when the return value is fulfilled.
$onRejected callable Callback to invoke when the return value is rejected.
return GuzzleHttp\HandlerStack

getLastOptions() public method

Get the last received request options.
public getLastOptions ( ) : array
return array

getLastRequest() public method

Get the last received request.
public getLastRequest ( ) : Psr\Http\Message\RequestInterface
return Psr\Http\Message\RequestInterface