private function HandlerStack::splice in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/guzzle/src/HandlerStack.php \GuzzleHttp\HandlerStack::splice()
Splices a function into the middleware list at a specific position.
Parameters
$findName:
$withName:
callable $middleware:
$before:
2 calls to HandlerStack::splice()
- HandlerStack::after in vendor/
guzzlehttp/ guzzle/ src/ HandlerStack.php - Add a middleware after another middleware by name.
- HandlerStack::before in vendor/
guzzlehttp/ guzzle/ src/ HandlerStack.php - Add a middleware before another middleware by name.
File
- vendor/
guzzlehttp/ guzzle/ src/ HandlerStack.php, line 230
Class
- HandlerStack
- Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.
Namespace
GuzzleHttpCode
private function splice($findName, $withName, callable $middleware, $before) {
$this->cached = null;
$idx = $this
->findByName($findName);
$tuple = [
$middleware,
$withName,
];
if ($before) {
if ($idx === 0) {
array_unshift($this->stack, $tuple);
}
else {
$replacement = [
$tuple,
$this->stack[$idx],
];
array_splice($this->stack, $idx, 1, $replacement);
}
}
elseif ($idx === count($this->stack) - 1) {
$this->stack[] = $tuple;
}
else {
$replacement = [
$this->stack[$idx],
$tuple,
];
array_splice($this->stack, $idx, 1, $replacement);
}
}