Documentation

HistoryPlugin
in package
implements EventSubscriberInterface, IteratorAggregate, Countable

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

Table of Contents

Interfaces

EventSubscriberInterface
An EventSubscriber knows himself what events he is interested in.
IteratorAggregate
Countable

Properties

$limit  : int
$transactions  : array<string|int, mixed>

Methods

__toString()  : string
Convert to a string that contains all request and response headers
add()  : HistoryPlugin
Add a request to the history
clear()  : HistoryPlugin
Clears the history
count()  : int
Get the number of requests in the history
getAll()  : array<string|int, mixed>
Get all of the raw transactions in the form of an array of associative arrays containing 'request' and 'response' keys.
getIterator()  : ArrayIterator
Get the requests in the history
getLastRequest()  : RequestInterface
Get the last request sent
getLastResponse()  : Response|null
Get the last response in the history
getLimit()  : int
Get the request limit
getSubscribedEvents()  : array<string|int, mixed>
Returns an array of event names this subscriber wants to listen to.
onRequestSent()  : mixed
setLimit()  : HistoryPlugin
Set the max number of requests to store

Properties

$limit

protected int $limit = 10

The maximum number of requests to maintain in the history

$transactions

protected array<string|int, mixed> $transactions = array()

Requests and responses that have passed through the plugin

Methods

__toString()

Convert to a string that contains all request and response headers

public __toString() : string
Return values
string

count()

Get the number of requests in the history

public count() : int
Return values
int

getAll()

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

public getAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

getIterator()

Get the requests in the history

public getIterator() : ArrayIterator
Return values
ArrayIterator

getLimit()

Get the request limit

public getLimit() : int
Return values
int

getSubscribedEvents()

Returns an array of event names this subscriber wants to listen to.

public static getSubscribedEvents() : array<string|int, mixed>

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2')))
Return values
array<string|int, mixed>

The event names to listen to


        
On this page

Search results