Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache
File: CallbackCanCacheStrategy.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Guzzle\Plugin\Cache;
[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
[7] Fix | Delete
/**
[8] Fix | Delete
* Determines if a request can be cached using a callback
[9] Fix | Delete
*/
[10] Fix | Delete
class CallbackCanCacheStrategy extends DefaultCanCacheStrategy
[11] Fix | Delete
{
[12] Fix | Delete
/** @var callable Callback for request */
[13] Fix | Delete
protected $requestCallback;
[14] Fix | Delete
[15] Fix | Delete
/** @var callable Callback for response */
[16] Fix | Delete
protected $responseCallback;
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* @param \Closure|array|mixed $requestCallback Callable method to invoke for requests
[20] Fix | Delete
* @param \Closure|array|mixed $responseCallback Callable method to invoke for responses
[21] Fix | Delete
*
[22] Fix | Delete
* @throws InvalidArgumentException
[23] Fix | Delete
*/
[24] Fix | Delete
public function __construct($requestCallback = null, $responseCallback = null)
[25] Fix | Delete
{
[26] Fix | Delete
if ($requestCallback && !is_callable($requestCallback)) {
[27] Fix | Delete
throw new InvalidArgumentException('Method must be callable');
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
if ($responseCallback && !is_callable($responseCallback)) {
[31] Fix | Delete
throw new InvalidArgumentException('Method must be callable');
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$this->requestCallback = $requestCallback;
[35] Fix | Delete
$this->responseCallback = $responseCallback;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function canCacheRequest(RequestInterface $request)
[39] Fix | Delete
{
[40] Fix | Delete
return $this->requestCallback
[41] Fix | Delete
? call_user_func($this->requestCallback, $request)
[42] Fix | Delete
: parent::canCacheRequest($request);
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
public function canCacheResponse(Response $response)
[46] Fix | Delete
{
[47] Fix | Delete
return $this->responseCallback
[48] Fix | Delete
? call_user_func($this->responseCallback, $response)
[49] Fix | Delete
: parent::canCacheResponse($response);
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function