Open Journal Systems  3.3.0
Guzzle\Plugin\History\HistoryPlugin Class Reference
Inheritance diagram for Guzzle\Plugin\History\HistoryPlugin:
Symfony\Component\EventDispatcher\EventSubscriberInterface

Public Member Functions

 __toString ()
 
 add (RequestInterface $request, Response $response=null)
 
 clear ()
 
 count ()
 
 getAll ()
 
 getIterator ()
 
 getLastRequest ()
 
 getLastResponse ()
 
 getLimit ()
 
 onRequestSent (Event $event)
 
 setLimit ($limit)
 

Static Public Member Functions

static getSubscribedEvents ()
 

Protected Attributes

 $limit = 10
 
 $transactions = array()
 

Detailed Description

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

Definition at line 13 of file HistoryPlugin.php.

Member Function Documentation

◆ __toString()

Guzzle\Plugin\History\HistoryPlugin::__toString ( )

Convert to a string that contains all request and response headers

Returns
string

Definition at line 37 of file HistoryPlugin.php.

◆ add()

Guzzle\Plugin\History\HistoryPlugin::add ( RequestInterface  $request,
Response  $response = null 
)

Add a request to the history

Parameters
RequestInterface$requestRequest to add
Response$responseResponse of the request
Returns
HistoryPlugin

Definition at line 56 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\count(), and Guzzle\Http\Message\RequestInterface\getResponse().

Referenced by Guzzle\Tests\Plugin\History\HistoryPluginTest\addRequests(), and Guzzle\Plugin\History\HistoryPlugin\onRequestSent().

◆ clear()

Guzzle\Plugin\History\HistoryPlugin::clear ( )

Clears the history

Returns
HistoryPlugin

Definition at line 158 of file HistoryPlugin.php.

◆ count()

Guzzle\Plugin\History\HistoryPlugin::count ( )

Get the number of requests in the history

Returns
int

Definition at line 124 of file HistoryPlugin.php.

Referenced by Guzzle\Plugin\History\HistoryPlugin\add().

◆ getAll()

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.

Returns
array

Definition at line 100 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\$transactions.

◆ getIterator()

Guzzle\Plugin\History\HistoryPlugin::getIterator ( )

Get the requests in the history

Returns
\ArrayIterator

Definition at line 110 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\$transactions.

◆ getLastRequest()

Guzzle\Plugin\History\HistoryPlugin::getLastRequest ( )

Get the last request sent

Returns
RequestInterface

Definition at line 134 of file HistoryPlugin.php.

◆ getLastResponse()

Guzzle\Plugin\History\HistoryPlugin::getLastResponse ( )

Get the last response in the history

Returns
Response|null

Definition at line 146 of file HistoryPlugin.php.

◆ getLimit()

Guzzle\Plugin\History\HistoryPlugin::getLimit ( )

Get the request limit

Returns
int

Definition at line 89 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\$limit.

◆ getSubscribedEvents()

static Guzzle\Plugin\History\HistoryPlugin::getSubscribedEvents ( )
static

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

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')))
Returns
array The event names to listen to

Implements Symfony\Component\EventDispatcher\EventSubscriberInterface.

Definition at line 27 of file HistoryPlugin.php.

Referenced by Guzzle\Tests\Plugin\History\HistoryPluginTest\testDescribesSubscribedEvents().

◆ onRequestSent()

Guzzle\Plugin\History\HistoryPlugin::onRequestSent ( Event  $event)

Definition at line 165 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\add().

◆ setLimit()

Guzzle\Plugin\History\HistoryPlugin::setLimit (   $limit)

Set the max number of requests to store

Parameters
int$limitLimit
Returns
HistoryPlugin

Definition at line 77 of file HistoryPlugin.php.

References Guzzle\Plugin\History\HistoryPlugin\$limit.

Field Documentation

◆ $limit

int Guzzle\Plugin\History\HistoryPlugin::$limit = 10
protected

The maximum number of requests to maintain in the history

Definition at line 19 of file HistoryPlugin.php.

Referenced by Guzzle\Plugin\History\HistoryPlugin\getLimit(), and Guzzle\Plugin\History\HistoryPlugin\setLimit().

◆ $transactions

array Guzzle\Plugin\History\HistoryPlugin::$transactions = array()
protected

Requests and responses that have passed through the plugin

Definition at line 25 of file HistoryPlugin.php.

Referenced by Guzzle\Plugin\History\HistoryPlugin\getAll(), and Guzzle\Plugin\History\HistoryPlugin\getIterator().


The documentation for this class was generated from the following file: