BodyVisitor
extends AbstractRequestVisitor
in package
Visitor used to apply a body to a request
This visitor can use a data parameter of 'expect' to control the Expect header. Set the expect data parameter to false to disable the expect header, or set the value to an integer so that the expect 100-continue header is only added if the Content-Length of the entity body is greater than the value.
Table of Contents
Methods
- after() : mixed
- Called after visiting all parameters
- visit() : mixed
- Called once for each parameter being visited that matches the location type
- addExpectHeader() : mixed
- Add the appropriate expect header to a request
- prepareValue() : array<string|int, mixed>|mixed
- Prepare (filter and set desired name for request item) the value for request.
- resolveRecursively() : array<string|int, mixed>
- Map nested parameters into the location_key based parameters
Methods
after()
Called after visiting all parameters
public
after(CommandInterface $command, RequestInterface $request) : mixed
Parameters
- $command : CommandInterface
-
Command being visited
- $request : RequestInterface
-
Request being visited
Tags
visit()
Called once for each parameter being visited that matches the location type
public
visit(CommandInterface $command, RequestInterface $request, Parameter $param, mixed $value) : mixed
Parameters
- $command : CommandInterface
-
Command being visited
- $request : RequestInterface
-
Request being visited
- $param : Parameter
-
Parameter being visited
- $value : mixed
-
Value to set
addExpectHeader()
Add the appropriate expect header to a request
protected
addExpectHeader(EntityEnclosingRequestInterface $request, EntityBodyInterface $body, string|int $expect) : mixed
Parameters
- $request : EntityEnclosingRequestInterface
-
Request to update
- $body : EntityBodyInterface
-
Entity body of the request
- $expect : string|int
-
Expect header setting
prepareValue()
Prepare (filter and set desired name for request item) the value for request.
protected
prepareValue(mixed $value, Parameter $param) : array<string|int, mixed>|mixed
Parameters
- $value : mixed
- $param : Parameter
Return values
array<string|int, mixed>|mixedresolveRecursively()
Map nested parameters into the location_key based parameters
protected
resolveRecursively(array<string|int, mixed> $value, Parameter $param) : array<string|int, mixed>
Parameters
- $value : array<string|int, mixed>
-
Value to map
- $param : Parameter
-
Parameter that holds information about the current key
Return values
array<string|int, mixed> —Returns the mapped array