Class Guzzle\Plugin\History\HistoryPlugin

InheritanceGuzzle\Plugin\History\HistoryPlugin
ImplementsCountable, IteratorAggregate, Symfony\Component\EventDispatcher\EventSubscriberInterface

Maintains a list of requests and responses sent using a request or client

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$limit int The maximum number of requests to maintain in the history Guzzle\Plugin\History\HistoryPlugin
$transactions array Requests and responses that have passed through the plugin Guzzle\Plugin\History\HistoryPlugin

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__toString() Convert to a string that contains all request and response headers Guzzle\Plugin\History\HistoryPlugin
add() Add a request to the history Guzzle\Plugin\History\HistoryPlugin
clear() Clears the history Guzzle\Plugin\History\HistoryPlugin
count() Get the number of requests in the history Guzzle\Plugin\History\HistoryPlugin
getAll() Get all of the raw transactions in the form of an array of associative arrays containing 'request' and 'response' keys. Guzzle\Plugin\History\HistoryPlugin
getIterator() Get the requests in the history Guzzle\Plugin\History\HistoryPlugin
getLastRequest() Get the last request sent Guzzle\Plugin\History\HistoryPlugin
getLastResponse() Get the last response in the history Guzzle\Plugin\History\HistoryPlugin
getLimit() Get the request limit Guzzle\Plugin\History\HistoryPlugin
getSubscribedEvents() Guzzle\Plugin\History\HistoryPlugin
onRequestSent() Guzzle\Plugin\History\HistoryPlugin
setLimit() Set the max number of requests to store Guzzle\Plugin\History\HistoryPlugin

Property Details

$limit protected property

The maximum number of requests to maintain in the history

protected int $limit 10
$transactions protected property

Requests and responses that have passed through the plugin

protected array $transactions = []

Method Details

__toString() public method

Convert to a string that contains all request and response headers

public string __toString ( )
add() public method

Add a request to the history

public Guzzle\Plugin\History\HistoryPlugin add ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response null )
$request Guzzle\Http\Message\RequestInterface

Request to add

$response Guzzle\Http\Message\Response

Response of the request

clear() public method

Clears the history

public Guzzle\Plugin\History\HistoryPlugin clear ( )
count() public method

Get the number of requests in the history

public int count ( )
getAll() public method

Get all of the raw transactions in the form of an array of associative arrays containing 'request' and 'response' keys.

public array getAll ( )
getIterator() public method

Get the requests in the history

public ArrayIterator getIterator ( )
getLastRequest() public method

Get the last request sent

public Guzzle\Http\Message\RequestInterface getLastRequest ( )
getLastResponse() public method

Get the last response in the history

public Guzzle\Http\Message\Response|null getLastResponse ( )
getLimit() public method

Get the request limit

public int getLimit ( )
getSubscribedEvents() public static method

public static void getSubscribedEvents ( )
onRequestSent() public method

public void onRequestSent ( Guzzle\Common\Event $event )
$event
setLimit() public method

Set the max number of requests to store

public Guzzle\Plugin\History\HistoryPlugin setLimit ( $limit )
$limit int

Limit