You are here

public function HandlerStack::remove in Lockr 7.3

Remove a middleware by instance or name from the stack.

Parameters

callable|string $remove Middleware to remove by instance or name.:

File

vendor/guzzlehttp/guzzle/src/HandlerStack.php, line 174

Class

HandlerStack
Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.

Namespace

GuzzleHttp

Code

public function remove($remove) {
  $this->cached = null;
  $idx = is_callable($remove) ? 0 : 1;
  $this->stack = array_values(array_filter($this->stack, function ($tuple) use ($idx, $remove) {
    return $tuple[$idx] !== $remove;
  }));
}