Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wordpres.../vendor_p.../guzzleht.../psr7/src
File: Response.php
<?php
[0] Fix | Delete
[1] Fix | Delete
declare (strict_types=1);
[2] Fix | Delete
namespace YoastSEO_Vendor\GuzzleHttp\Psr7;
[3] Fix | Delete
[4] Fix | Delete
use YoastSEO_Vendor\Psr\Http\Message\ResponseInterface;
[5] Fix | Delete
use YoastSEO_Vendor\Psr\Http\Message\StreamInterface;
[6] Fix | Delete
/**
[7] Fix | Delete
* PSR-7 response implementation.
[8] Fix | Delete
*/
[9] Fix | Delete
class Response implements \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface
[10] Fix | Delete
{
[11] Fix | Delete
use MessageTrait;
[12] Fix | Delete
/** Map of standard HTTP status code/reason phrases */
[13] Fix | Delete
private const PHRASES = [100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required'];
[14] Fix | Delete
/** @var string */
[15] Fix | Delete
private $reasonPhrase;
[16] Fix | Delete
/** @var int */
[17] Fix | Delete
private $statusCode;
[18] Fix | Delete
/**
[19] Fix | Delete
* @param int $status Status code
[20] Fix | Delete
* @param (string|string[])[] $headers Response headers
[21] Fix | Delete
* @param string|resource|StreamInterface|null $body Response body
[22] Fix | Delete
* @param string $version Protocol version
[23] Fix | Delete
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
[24] Fix | Delete
*/
[25] Fix | Delete
public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
[26] Fix | Delete
{
[27] Fix | Delete
$this->assertStatusCodeRange($status);
[28] Fix | Delete
$this->statusCode = $status;
[29] Fix | Delete
if ($body !== '' && $body !== null) {
[30] Fix | Delete
$this->stream = \YoastSEO_Vendor\GuzzleHttp\Psr7\Utils::streamFor($body);
[31] Fix | Delete
}
[32] Fix | Delete
$this->setHeaders($headers);
[33] Fix | Delete
if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
[34] Fix | Delete
$this->reasonPhrase = self::PHRASES[$this->statusCode];
[35] Fix | Delete
} else {
[36] Fix | Delete
$this->reasonPhrase = (string) $reason;
[37] Fix | Delete
}
[38] Fix | Delete
$this->protocol = $version;
[39] Fix | Delete
}
[40] Fix | Delete
public function getStatusCode() : int
[41] Fix | Delete
{
[42] Fix | Delete
return $this->statusCode;
[43] Fix | Delete
}
[44] Fix | Delete
public function getReasonPhrase() : string
[45] Fix | Delete
{
[46] Fix | Delete
return $this->reasonPhrase;
[47] Fix | Delete
}
[48] Fix | Delete
public function withStatus($code, $reasonPhrase = '') : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface
[49] Fix | Delete
{
[50] Fix | Delete
$this->assertStatusCodeIsInteger($code);
[51] Fix | Delete
$code = (int) $code;
[52] Fix | Delete
$this->assertStatusCodeRange($code);
[53] Fix | Delete
$new = clone $this;
[54] Fix | Delete
$new->statusCode = $code;
[55] Fix | Delete
if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
[56] Fix | Delete
$reasonPhrase = self::PHRASES[$new->statusCode];
[57] Fix | Delete
}
[58] Fix | Delete
$new->reasonPhrase = (string) $reasonPhrase;
[59] Fix | Delete
return $new;
[60] Fix | Delete
}
[61] Fix | Delete
/**
[62] Fix | Delete
* @param mixed $statusCode
[63] Fix | Delete
*/
[64] Fix | Delete
private function assertStatusCodeIsInteger($statusCode) : void
[65] Fix | Delete
{
[66] Fix | Delete
if (\filter_var($statusCode, \FILTER_VALIDATE_INT) === \false) {
[67] Fix | Delete
throw new \InvalidArgumentException('Status code must be an integer value.');
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
private function assertStatusCodeRange(int $statusCode) : void
[71] Fix | Delete
{
[72] Fix | Delete
if ($statusCode < 100 || $statusCode >= 600) {
[73] Fix | Delete
throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
[74] Fix | Delete
}
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function