OperationResponseParser
extends DefaultResponseParser
in package
Response parser that attempts to marshal responses into an associative array based on models in a service description
Table of Contents
Properties
- $factory : VisitorFlyweight
- $instance : self
- $schemaInModels : bool
Methods
- __construct() : mixed
- addVisitor() : self
- Add a location visitor to the command
- getInstance() : self
- parse() : mixed
- Parse the HTTP response received by the command and update the command's result contents
- handleParsing() : mixed
- parseClass() : mixed
- Parse a class object
- visitAdditionalProperties() : mixed
- visitResult() : array<string|int, mixed>
- Perform transformations on the result array
Properties
$factory
protected
VisitorFlyweight
$factory
Visitor factory
$instance
protected
static self
$instance
$schemaInModels
private
bool
$schemaInModels
Methods
__construct()
public
__construct(VisitorFlyweight $factory[, bool $schemaInModels = false ]) : mixed
Parameters
- $factory : VisitorFlyweight
-
Factory to use when creating visitors
- $schemaInModels : bool = false
-
Set to true to inject schemas into models
addVisitor()
Add a location visitor to the command
public
addVisitor(string $location, ResponseVisitorInterface $visitor) : self
Parameters
- $location : string
-
Location to associate with the visitor
- $visitor : ResponseVisitorInterface
-
Visitor to attach
Return values
selfgetInstance()
public
static getInstance() : self
Tags
Return values
selfparse()
Parse the HTTP response received by the command and update the command's result contents
public
parse(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command to parse and update
Return values
mixed —Returns the result to set on the command
handleParsing()
protected
handleParsing(CommandInterface $command, Response $response, mixed $contentType) : mixed
Parameters
- $command : CommandInterface
- $response : Response
- $contentType : mixed
parseClass()
Parse a class object
protected
parseClass(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command to parse into an object
Tags
visitAdditionalProperties()
protected
visitAdditionalProperties(Parameter $model, CommandInterface $command, Response $response, Parameter $additional, mixed &$result, array<string|int, mixed> &$foundVisitors) : mixed
Parameters
- $model : Parameter
- $command : CommandInterface
- $response : Response
- $additional : Parameter
- $result : mixed
- $foundVisitors : array<string|int, mixed>
visitResult()
Perform transformations on the result array
protected
visitResult(Parameter $model, CommandInterface $command, Response $response) : array<string|int, mixed>
Parameters
- $model : Parameter
-
Model that defines the structure
- $command : CommandInterface
-
Command that performed the operation
- $response : Response
-
Response received
Return values
array<string|int, mixed> —Returns the array of result data