* Remove a middleware by instance or name from the stack.
*
* @param callable|string $remove Middleware to remove by instance or name.
*/
publicfunctionremove($remove):void
{
if(!is_string($remove)&&!is_callable($remove)){
trigger_deprecation('guzzlehttp/guzzle','7.4','Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.',__CLASS__,__FUNCTION__);
}
$this->cached=null;
$idx=\is_callable($remove)?0:1;
$this->stack=\array_values(\array_filter(
$this->stack,
staticfunction($tuple)use($idx,$remove){
return$tuple[$idx]!==$remove;
}
));
}
/**
* Compose the middleware and handler into a single callable function.