Open Monograph Press
3.3.0
|
Public Member Functions | |
__construct (callable $handler=null) | |
__invoke (RequestInterface $request, array $options) | |
__toString () | |
after ($findName, callable $middleware, $withName='') | |
before ($findName, callable $middleware, $withName='') | |
hasHandler () | |
push (callable $middleware, $name='') | |
remove ($remove) | |
resolve () | |
setHandler (callable $handler) | |
unshift (callable $middleware, $name=null) | |
Static Public Member Functions | |
static | create (callable $handler=null) |
Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.
Definition at line 12 of file HandlerStack.php.
GuzzleHttp\HandlerStack::__construct | ( | callable | $handler = null | ) |
callable | $handler | Underlying HTTP handler. |
Definition at line 63 of file HandlerStack.php.
GuzzleHttp\HandlerStack::__invoke | ( | RequestInterface | $request, |
array | $options | ||
) |
Invokes the handler stack as a composed handler
RequestInterface | $request | |
array | $options |
Definition at line 76 of file HandlerStack.php.
GuzzleHttp\HandlerStack::__toString | ( | ) |
Dumps a string representation of the stack.
Definition at line 88 of file HandlerStack.php.
GuzzleHttp\HandlerStack::after | ( | $findName, | |
callable | $middleware, | ||
$withName = '' |
|||
) |
Add a middleware after another middleware by name.
string | $findName | Middleware to find |
callable | $middleware | Middleware function |
string | $withName | Name to register for this middleware. |
Definition at line 177 of file HandlerStack.php.
GuzzleHttp\HandlerStack::before | ( | $findName, | |
callable | $middleware, | ||
$withName = '' |
|||
) |
Add a middleware before another middleware by name.
string | $findName | Middleware to find |
callable | $middleware | Middleware function |
string | $withName | Name to register for this middleware. |
Definition at line 165 of file HandlerStack.php.
|
static |
Creates a default handler stack that can be used by clients.
The returned handler will wrap the provided handler or use the most appropriate default handler for your system. The returned HandlerStack has support for cookies, redirects, HTTP error exceptions, and preparing a body before sending.
The returned handler stack can be passed to a client in the "handler" option.
callable | $handler | HTTP handler function to use with the stack. If no handler is provided, the best handler for your system will be utilized. |
Definition at line 49 of file HandlerStack.php.
References GuzzleHttp\choose_handler().
Referenced by GuzzleHttp\Handler\MockHandler\createWithMiddleware().
GuzzleHttp\HandlerStack::hasHandler | ( | ) |
Returns true if the builder has a handler.
Definition at line 129 of file HandlerStack.php.
GuzzleHttp\HandlerStack::push | ( | callable | $middleware, |
$name = '' |
|||
) |
Push a middleware to the top of the stack.
callable | $middleware | Middleware function |
string | $name | Name to register for this middleware. |
Definition at line 152 of file HandlerStack.php.
GuzzleHttp\HandlerStack::remove | ( | $remove | ) |
Remove a middleware by instance or name from the stack.
callable | string | $remove | Middleware to remove by instance or name. |
Definition at line 187 of file HandlerStack.php.
GuzzleHttp\HandlerStack::resolve | ( | ) |
Compose the middleware and handler into a single callable function.
Definition at line 204 of file HandlerStack.php.
GuzzleHttp\HandlerStack::setHandler | ( | callable | $handler | ) |
Set the HTTP handler that actually returns a promise.
callable | $handler | Accepts a request and array of options and returns a Promise. |
Definition at line 118 of file HandlerStack.php.
GuzzleHttp\HandlerStack::unshift | ( | callable | $middleware, |
$name = null |
|||
) |
Unshift a middleware to the bottom of the stack.
callable | $middleware | Middleware function |
string | $name | Name to register for this middleware. |
Definition at line 140 of file HandlerStack.php.