VisitorFlyweight
in package
Flyweight factory used to instantiate request and response visitors
Table of Contents
Properties
- $cache : array<string|int, mixed>
- $defaultMappings : array<string|int, mixed>
- $instance : self
- $mappings : array<string|int, mixed>
Methods
- __construct() : mixed
- addRequestVisitor() : self
- Add a response visitor to the factory by name
- addResponseVisitor() : self
- Add a response visitor to the factory by name
- getInstance() : self
- getRequestVisitor() : RequestVisitorInterface
- Get an instance of a request visitor by location name
- getResponseVisitor() : ResponseVisitorInterface
- Get an instance of a response visitor by location name
- getKey() : mixed
- Get a visitor by key value name
Properties
$cache
protected
array<string|int, mixed>
$cache
= array()
Cache of instantiated visitors
$defaultMappings
protected
static array<string|int, mixed>
$defaultMappings
= array('request.body' => 'Guzzle\Service\Command\LocationVisitor\Request\BodyVisitor', 'request.header' => 'Guzzle\Service\Command\LocationVisitor\Request\HeaderVisitor', 'request.json' => 'Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor', 'request.postField' => 'Guzzle\Service\Command\LocationVisitor\Request\PostFieldVisitor', 'request.postFile' => 'Guzzle\Service\Command\LocationVisitor\Request\PostFileVisitor', 'request.query' => 'Guzzle\Service\Command\LocationVisitor\Request\QueryVisitor', 'request.response_body' => 'Guzzle\Service\Command\LocationVisitor\Request\ResponseBodyVisitor', 'request.responseBody' => 'Guzzle\Service\Command\LocationVisitor\Request\ResponseBodyVisitor', 'request.xml' => 'Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor', 'response.body' => 'Guzzle\Service\Command\LocationVisitor\Response\BodyVisitor', 'response.header' => 'Guzzle\Service\Command\LocationVisitor\Response\HeaderVisitor', 'response.json' => 'Guzzle\Service\Command\LocationVisitor\Response\JsonVisitor', 'response.reasonPhrase' => 'Guzzle\Service\Command\LocationVisitor\Response\ReasonPhraseVisitor', 'response.statusCode' => 'Guzzle\Service\Command\LocationVisitor\Response\StatusCodeVisitor', 'response.xml' => 'Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor')
Default array of mappings of location names to classes
$instance
protected
static self
$instance
Singleton instance of self
$mappings
protected
array<string|int, mixed>
$mappings
Array of mappings of location names to classes
Methods
__construct()
public
__construct([array<string|int, mixed> $mappings = null ]) : mixed
Parameters
- $mappings : array<string|int, mixed> = null
-
Array mapping request.name and response.name to location visitor classes. Leave null to use the default values.
addRequestVisitor()
Add a response visitor to the factory by name
public
addRequestVisitor(string $name, RequestVisitorInterface $visitor) : self
Parameters
- $name : string
-
Name of the visitor
- $visitor : RequestVisitorInterface
-
Visitor to add
Return values
selfaddResponseVisitor()
Add a response visitor to the factory by name
public
addResponseVisitor(string $name, ResponseVisitorInterface $visitor) : self
Parameters
- $name : string
-
Name of the visitor
- $visitor : ResponseVisitorInterface
-
Visitor to add
Return values
selfgetInstance()
public
static getInstance() : self
Tags
Return values
selfgetRequestVisitor()
Get an instance of a request visitor by location name
public
getRequestVisitor(string $visitor) : RequestVisitorInterface
Parameters
- $visitor : string
-
Visitor name
Return values
RequestVisitorInterfacegetResponseVisitor()
Get an instance of a response visitor by location name
public
getResponseVisitor(string $visitor) : ResponseVisitorInterface
Parameters
- $visitor : string
-
Visitor name
Return values
ResponseVisitorInterfacegetKey()
Get a visitor by key value name
private
getKey(string $key) : mixed
Parameters
- $key : string
-
Key name to retrieve