Edit File by line
/home/zeestwma/redstone.../wp-inclu.../SimplePi.../src/HTTP
File: Response.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
[2] Fix | Delete
// SPDX-FileCopyrightText: 2014 PHP Framework Interoperability Group
[3] Fix | Delete
// SPDX-License-Identifier: MIT
[4] Fix | Delete
[5] Fix | Delete
declare(strict_types=1);
[6] Fix | Delete
[7] Fix | Delete
namespace SimplePie\HTTP;
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* HTTP Response interface
[11] Fix | Delete
*
[12] Fix | Delete
* This interface must be interoperable with Psr\Http\Message\ResponseInterface
[13] Fix | Delete
* @see https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface
[14] Fix | Delete
*
[15] Fix | Delete
* @internal
[16] Fix | Delete
*/
[17] Fix | Delete
interface Response
[18] Fix | Delete
{
[19] Fix | Delete
/**
[20] Fix | Delete
* Return the string representation of the permanent URI of the requested resource
[21] Fix | Delete
* (the first location after a prefix of (only) permanent redirects).
[22] Fix | Delete
*
[23] Fix | Delete
* Depending on which components of the URI are present, the resulting
[24] Fix | Delete
* string is either a full URI or relative reference according to RFC 3986,
[25] Fix | Delete
* Section 4.1. The method concatenates the various components of the URI,
[26] Fix | Delete
* using the appropriate delimiters:
[27] Fix | Delete
*
[28] Fix | Delete
* - If a scheme is present, it MUST be suffixed by ":".
[29] Fix | Delete
* - If an authority is present, it MUST be prefixed by "//".
[30] Fix | Delete
* - The path can be concatenated without delimiters. But there are two
[31] Fix | Delete
* cases where the path has to be adjusted to make the URI reference
[32] Fix | Delete
* valid as PHP does not allow to throw an exception in __toString():
[33] Fix | Delete
* - If the path is rootless and an authority is present, the path MUST
[34] Fix | Delete
* be prefixed by "/".
[35] Fix | Delete
* - If the path is starting with more than one "/" and no authority is
[36] Fix | Delete
* present, the starting slashes MUST be reduced to one.
[37] Fix | Delete
* - If a query is present, it MUST be prefixed by "?".
[38] Fix | Delete
* - If a fragment is present, it MUST be prefixed by "#".
[39] Fix | Delete
*
[40] Fix | Delete
* @see http://tools.ietf.org/html/rfc3986#section-4.1
[41] Fix | Delete
*/
[42] Fix | Delete
public function get_permanent_uri(): string;
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Return the string representation of the final requested URL after following all redirects.
[46] Fix | Delete
*
[47] Fix | Delete
* Depending on which components of the URI are present, the resulting
[48] Fix | Delete
* string is either a full URI or relative reference according to RFC 3986,
[49] Fix | Delete
* Section 4.1. The method concatenates the various components of the URI,
[50] Fix | Delete
* using the appropriate delimiters:
[51] Fix | Delete
*
[52] Fix | Delete
* - If a scheme is present, it MUST be suffixed by ":".
[53] Fix | Delete
* - If an authority is present, it MUST be prefixed by "//".
[54] Fix | Delete
* - The path can be concatenated without delimiters. But there are two
[55] Fix | Delete
* cases where the path has to be adjusted to make the URI reference
[56] Fix | Delete
* valid as PHP does not allow to throw an exception in __toString():
[57] Fix | Delete
* - If the path is rootless and an authority is present, the path MUST
[58] Fix | Delete
* be prefixed by "/".
[59] Fix | Delete
* - If the path is starting with more than one "/" and no authority is
[60] Fix | Delete
* present, the starting slashes MUST be reduced to one.
[61] Fix | Delete
* - If a query is present, it MUST be prefixed by "?".
[62] Fix | Delete
* - If a fragment is present, it MUST be prefixed by "#".
[63] Fix | Delete
*
[64] Fix | Delete
* @see http://tools.ietf.org/html/rfc3986#section-4.1
[65] Fix | Delete
*/
[66] Fix | Delete
public function get_final_requested_uri(): string;
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Gets the response status code.
[70] Fix | Delete
*
[71] Fix | Delete
* The status code is a 3-digit integer result code of the server's attempt
[72] Fix | Delete
* to understand and satisfy the request.
[73] Fix | Delete
*
[74] Fix | Delete
* @return int Status code.
[75] Fix | Delete
*/
[76] Fix | Delete
public function get_status_code(): int;
[77] Fix | Delete
[78] Fix | Delete
/**
[79] Fix | Delete
* Retrieves all message header values.
[80] Fix | Delete
*
[81] Fix | Delete
* The keys represent the header name as it will be sent over the wire, and
[82] Fix | Delete
* each value is an array of strings associated with the header.
[83] Fix | Delete
*
[84] Fix | Delete
* // Represent the headers as a string
[85] Fix | Delete
* foreach ($message->get_headers() as $name => $values) {
[86] Fix | Delete
* echo $name . ': ' . implode(', ', $values);
[87] Fix | Delete
* }
[88] Fix | Delete
*
[89] Fix | Delete
* // Emit headers iteratively:
[90] Fix | Delete
* foreach ($message->get_headers() as $name => $values) {
[91] Fix | Delete
* foreach ($values as $value) {
[92] Fix | Delete
* header(sprintf('%s: %s', $name, $value), false);
[93] Fix | Delete
* }
[94] Fix | Delete
* }
[95] Fix | Delete
*
[96] Fix | Delete
* @return array<non-empty-array<string>> Returns an associative array of the message's headers.
[97] Fix | Delete
* Each key MUST be a header name, and each value MUST be an array of
[98] Fix | Delete
* strings for that header.
[99] Fix | Delete
*/
[100] Fix | Delete
public function get_headers(): array;
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Checks if a header exists by the given case-insensitive name.
[104] Fix | Delete
*
[105] Fix | Delete
* @param string $name Case-insensitive header field name.
[106] Fix | Delete
* @return bool Returns true if any header names match the given header
[107] Fix | Delete
* name using a case-insensitive string comparison. Returns false if
[108] Fix | Delete
* no matching header name is found in the message.
[109] Fix | Delete
*/
[110] Fix | Delete
public function has_header(string $name): bool;
[111] Fix | Delete
[112] Fix | Delete
/**
[113] Fix | Delete
* Retrieves a message header value by the given case-insensitive name.
[114] Fix | Delete
*
[115] Fix | Delete
* This method returns an array of all the header values of the given
[116] Fix | Delete
* case-insensitive header name.
[117] Fix | Delete
*
[118] Fix | Delete
* If the header does not appear in the message, this method MUST return an
[119] Fix | Delete
* empty array.
[120] Fix | Delete
*
[121] Fix | Delete
* @param string $name Case-insensitive header field name.
[122] Fix | Delete
* @return string[] An array of string values as provided for the given
[123] Fix | Delete
* header. If the header does not appear in the message, this method MUST
[124] Fix | Delete
* return an empty array.
[125] Fix | Delete
*/
[126] Fix | Delete
public function get_header(string $name): array;
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* Return an instance with the provided value replacing the specified header.
[130] Fix | Delete
*
[131] Fix | Delete
* This method MUST be implemented in such a way as to retain the
[132] Fix | Delete
* immutability of the message, and MUST return an instance that has the
[133] Fix | Delete
* new and/or updated header and value.
[134] Fix | Delete
*
[135] Fix | Delete
* @param string $name Case-insensitive header field name.
[136] Fix | Delete
* @param string|non-empty-array<string> $value Header value(s).
[137] Fix | Delete
* @return static
[138] Fix | Delete
* @throws \InvalidArgumentException for invalid header names or values.
[139] Fix | Delete
*/
[140] Fix | Delete
public function with_header(string $name, $value);
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Retrieves a comma-separated string of the values for a single header.
[144] Fix | Delete
*
[145] Fix | Delete
* This method returns all of the header values of the given
[146] Fix | Delete
* case-insensitive header name as a string concatenated together using
[147] Fix | Delete
* a comma.
[148] Fix | Delete
*
[149] Fix | Delete
* NOTE: Not all header values may be appropriately represented using
[150] Fix | Delete
* comma concatenation. For such headers, use getHeader() instead
[151] Fix | Delete
* and supply your own delimiter when concatenating.
[152] Fix | Delete
*
[153] Fix | Delete
* If the header does not appear in the message, this method MUST return
[154] Fix | Delete
* an empty string.
[155] Fix | Delete
*
[156] Fix | Delete
* @param string $name Case-insensitive header field name.
[157] Fix | Delete
* @return string A string of values as provided for the given header
[158] Fix | Delete
* concatenated together using a comma. If the header does not appear in
[159] Fix | Delete
* the message, this method MUST return an empty string.
[160] Fix | Delete
*/
[161] Fix | Delete
public function get_header_line(string $name): string;
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* get the body as string
[165] Fix | Delete
*
[166] Fix | Delete
* @return string
[167] Fix | Delete
*/
[168] Fix | Delete
public function get_body_content(): string;
[169] Fix | Delete
}
[170] Fix | Delete
[171] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function