Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff
File: CallbackBackoffStrategy.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Guzzle\Plugin\Backoff;
[2] Fix | Delete
[3] Fix | Delete
use Guzzle\Common\Exception\InvalidArgumentException;
[4] Fix | Delete
use Guzzle\Http\Message\RequestInterface;
[5] Fix | Delete
use Guzzle\Http\Message\Response;
[6] Fix | Delete
use Guzzle\Http\Exception\HttpException;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Strategy that will invoke a closure to determine whether or not to retry with a delay
[10] Fix | Delete
*/
[11] Fix | Delete
class CallbackBackoffStrategy extends AbstractBackoffStrategy
[12] Fix | Delete
{
[13] Fix | Delete
/** @var \Closure|array|mixed Callable method to invoke */
[14] Fix | Delete
protected $callback;
[15] Fix | Delete
[16] Fix | Delete
/** @var bool Whether or not this strategy makes a retry decision */
[17] Fix | Delete
protected $decision;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* @param \Closure|array|mixed $callback Callable method to invoke
[21] Fix | Delete
* @param bool $decision Set to true if this strategy makes a backoff decision
[22] Fix | Delete
* @param BackoffStrategyInterface $next The optional next strategy
[23] Fix | Delete
*
[24] Fix | Delete
* @throws InvalidArgumentException
[25] Fix | Delete
*/
[26] Fix | Delete
public function __construct($callback, $decision, BackoffStrategyInterface $next = null)
[27] Fix | Delete
{
[28] Fix | Delete
if (!is_callable($callback)) {
[29] Fix | Delete
throw new InvalidArgumentException('The callback must be callable');
[30] Fix | Delete
}
[31] Fix | Delete
$this->callback = $callback;
[32] Fix | Delete
$this->decision = (bool) $decision;
[33] Fix | Delete
$this->next = $next;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
public function makesDecision()
[37] Fix | Delete
{
[38] Fix | Delete
return $this->decision;
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null)
[42] Fix | Delete
{
[43] Fix | Delete
return call_user_func($this->callback, $retries, $request, $response, $e);
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function