Builds a single handler function from zero or more middleware functions and a handler. The handler function is then used to send command objects and return a promise that is resolved with an AWS result object.
The "front" of the list is invoked before the "end" of the list. You can add middleware to the front of the list using one of the "prepend" method, and the end of the list using one of the "append" method. The last function invoked in a handler list is the handler (a function that does not accept a next handler but rather is responsible for returning a promise that is fulfilled with an Aws\ResultInterface object).
Handlers are ordered using a "step" that describes the step at which the SDK is when sending a command. The available steps are:
Middleware can be registered with a name to allow you to easily add a middleware before or after another middleware by name. This also allows you to remove a middleware by name (in addition to removing by instance).
Table of Contents Interfaces public mixed ATTEMPT = 'attempt'
BUILD public mixed BUILD = 'build'
INIT public mixed INIT = 'init'
SIGN public mixed SIGN = 'sign'
VALIDATE public mixed VALIDATE = 'validate'
__construct() public __construct([callable $handler = null ]) : mixed
Parameters
HTTP handler.
Dumps a string representation of the list.
public __toString() : string
Return valuesstring after()
Add a middleware after the given middleware by name.
public after(string|callable $findName, string $withName, callable $middleware) : mixed
Parameters
Add after this
Optional name to give the middleware
Middleware to add.
Append a middleware to the attempt step.
public appendAttempt(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Append a middleware to the build step.
public appendBuild(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Append a middleware to the init step.
public appendInit(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Append a middleware to the sign step.
public appendSign(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Append a middleware to the validate step.
public appendValidate(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Add a middleware before the given middleware by name.
public before(string|callable $findName, string $withName, callable $middleware) : mixed
Parameters
Add before this
Optional name to give the middleware
Middleware to add.
public count() : int
Return valuesint hasHandler()
Returns true if the builder has a handler.
public hasHandler() : bool
Return valuesbool hasMiddleware()
Checks if a middleware exists. The middleware should have been added with a name in order to use this method.
public hasMiddleware(string $name) : bool
Parameters
Interpose a function between each middleware (e.g., allowing for a trace through the middleware layers).
public interpose([callable|null $fn = null ]) : mixed
The interpose function is a function that accepts a "step" argument as a string and a "name" argument string. This function must then return a function that accepts the next handler in the list. This function must then return a function that accepts a CommandInterface and optional RequestInterface and returns a promise that is fulfilled with an Aws\ResultInterface or rejected with an Aws\Exception\AwsException object.
ParametersPass null to remove any previously set function
Prepend a middleware to the attempt step.
public prependAttempt(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Prepend a middleware to the build step.
public prependBuild(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Prepend a middleware to the init step.
public prependInit(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Prepend a middleware to the sign step.
public prependSign(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Prepend a middleware to the validate step.
public prependValidate(callable $middleware[, string $name = null ]) : mixed
Parameters
Middleware function to add.
Name of the middleware.
Remove a middleware by name or by instance from the list.
public remove(string|callable $nameOrInstance) : mixed
Parameters
Middleware to remove.
Compose the middleware and handler into a single callable function.
public resolve() : callable
Return valuescallable setHandler()
Set the HTTP handler that actually returns a response.
public setHandler(callable $handler) : mixed
Parameters
Function that accepts a request and array of options and returns a Promise.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4