Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../vendor/guzzleht.../psr7/src
File: functions.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace GuzzleHttp\Psr7;
[2] Fix | Delete
[3] Fix | Delete
use Psr\Http\Message\MessageInterface;
[4] Fix | Delete
use Psr\Http\Message\RequestInterface;
[5] Fix | Delete
use Psr\Http\Message\StreamInterface;
[6] Fix | Delete
use Psr\Http\Message\UriInterface;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Returns the string representation of an HTTP message.
[10] Fix | Delete
*
[11] Fix | Delete
* @param MessageInterface $message Message to convert to a string.
[12] Fix | Delete
*
[13] Fix | Delete
* @return string
[14] Fix | Delete
*
[15] Fix | Delete
* @deprecated str will be removed in guzzlehttp/psr7:2.0. Use Message::toString instead.
[16] Fix | Delete
*/
[17] Fix | Delete
function str(MessageInterface $message)
[18] Fix | Delete
{
[19] Fix | Delete
return Message::toString($message);
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Returns a UriInterface for the given value.
[24] Fix | Delete
*
[25] Fix | Delete
* This function accepts a string or UriInterface and returns a
[26] Fix | Delete
* UriInterface for the given value. If the value is already a
[27] Fix | Delete
* UriInterface, it is returned as-is.
[28] Fix | Delete
*
[29] Fix | Delete
* @param string|UriInterface $uri
[30] Fix | Delete
*
[31] Fix | Delete
* @return UriInterface
[32] Fix | Delete
*
[33] Fix | Delete
* @throws \InvalidArgumentException
[34] Fix | Delete
*
[35] Fix | Delete
* @deprecated uri_for will be removed in guzzlehttp/psr7:2.0. Use Utils::uriFor instead.
[36] Fix | Delete
*/
[37] Fix | Delete
function uri_for($uri)
[38] Fix | Delete
{
[39] Fix | Delete
return Utils::uriFor($uri);
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Create a new stream based on the input type.
[44] Fix | Delete
*
[45] Fix | Delete
* Options is an associative array that can contain the following keys:
[46] Fix | Delete
* - metadata: Array of custom metadata.
[47] Fix | Delete
* - size: Size of the stream.
[48] Fix | Delete
*
[49] Fix | Delete
* This method accepts the following `$resource` types:
[50] Fix | Delete
* - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
[51] Fix | Delete
* - `string`: Creates a stream object that uses the given string as the contents.
[52] Fix | Delete
* - `resource`: Creates a stream object that wraps the given PHP stream resource.
[53] Fix | Delete
* - `Iterator`: If the provided value implements `Iterator`, then a read-only
[54] Fix | Delete
* stream object will be created that wraps the given iterable. Each time the
[55] Fix | Delete
* stream is read from, data from the iterator will fill a buffer and will be
[56] Fix | Delete
* continuously called until the buffer is equal to the requested read size.
[57] Fix | Delete
* Subsequent read calls will first read from the buffer and then call `next`
[58] Fix | Delete
* on the underlying iterator until it is exhausted.
[59] Fix | Delete
* - `object` with `__toString()`: If the object has the `__toString()` method,
[60] Fix | Delete
* the object will be cast to a string and then a stream will be returned that
[61] Fix | Delete
* uses the string value.
[62] Fix | Delete
* - `NULL`: When `null` is passed, an empty stream object is returned.
[63] Fix | Delete
* - `callable` When a callable is passed, a read-only stream object will be
[64] Fix | Delete
* created that invokes the given callable. The callable is invoked with the
[65] Fix | Delete
* number of suggested bytes to read. The callable can return any number of
[66] Fix | Delete
* bytes, but MUST return `false` when there is no more data to return. The
[67] Fix | Delete
* stream object that wraps the callable will invoke the callable until the
[68] Fix | Delete
* number of requested bytes are available. Any additional bytes will be
[69] Fix | Delete
* buffered and used in subsequent reads.
[70] Fix | Delete
*
[71] Fix | Delete
* @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
[72] Fix | Delete
* @param array $options Additional options
[73] Fix | Delete
*
[74] Fix | Delete
* @return StreamInterface
[75] Fix | Delete
*
[76] Fix | Delete
* @throws \InvalidArgumentException if the $resource arg is not valid.
[77] Fix | Delete
*
[78] Fix | Delete
* @deprecated stream_for will be removed in guzzlehttp/psr7:2.0. Use Utils::streamFor instead.
[79] Fix | Delete
*/
[80] Fix | Delete
function stream_for($resource = '', array $options = [])
[81] Fix | Delete
{
[82] Fix | Delete
return Utils::streamFor($resource, $options);
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Parse an array of header values containing ";" separated data into an
[87] Fix | Delete
* array of associative arrays representing the header key value pair data
[88] Fix | Delete
* of the header. When a parameter does not contain a value, but just
[89] Fix | Delete
* contains a key, this function will inject a key with a '' string value.
[90] Fix | Delete
*
[91] Fix | Delete
* @param string|array $header Header to parse into components.
[92] Fix | Delete
*
[93] Fix | Delete
* @return array Returns the parsed header values.
[94] Fix | Delete
*
[95] Fix | Delete
* @deprecated parse_header will be removed in guzzlehttp/psr7:2.0. Use Header::parse instead.
[96] Fix | Delete
*/
[97] Fix | Delete
function parse_header($header)
[98] Fix | Delete
{
[99] Fix | Delete
return Header::parse($header);
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Converts an array of header values that may contain comma separated
[104] Fix | Delete
* headers into an array of headers with no comma separated values.
[105] Fix | Delete
*
[106] Fix | Delete
* @param string|array $header Header to normalize.
[107] Fix | Delete
*
[108] Fix | Delete
* @return array Returns the normalized header field values.
[109] Fix | Delete
*
[110] Fix | Delete
* @deprecated normalize_header will be removed in guzzlehttp/psr7:2.0. Use Header::normalize instead.
[111] Fix | Delete
*/
[112] Fix | Delete
function normalize_header($header)
[113] Fix | Delete
{
[114] Fix | Delete
return Header::normalize($header);
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Clone and modify a request with the given changes.
[119] Fix | Delete
*
[120] Fix | Delete
* This method is useful for reducing the number of clones needed to mutate a
[121] Fix | Delete
* message.
[122] Fix | Delete
*
[123] Fix | Delete
* The changes can be one of:
[124] Fix | Delete
* - method: (string) Changes the HTTP method.
[125] Fix | Delete
* - set_headers: (array) Sets the given headers.
[126] Fix | Delete
* - remove_headers: (array) Remove the given headers.
[127] Fix | Delete
* - body: (mixed) Sets the given body.
[128] Fix | Delete
* - uri: (UriInterface) Set the URI.
[129] Fix | Delete
* - query: (string) Set the query string value of the URI.
[130] Fix | Delete
* - version: (string) Set the protocol version.
[131] Fix | Delete
*
[132] Fix | Delete
* @param RequestInterface $request Request to clone and modify.
[133] Fix | Delete
* @param array $changes Changes to apply.
[134] Fix | Delete
*
[135] Fix | Delete
* @return RequestInterface
[136] Fix | Delete
*
[137] Fix | Delete
* @deprecated modify_request will be removed in guzzlehttp/psr7:2.0. Use Utils::modifyRequest instead.
[138] Fix | Delete
*/
[139] Fix | Delete
function modify_request(RequestInterface $request, array $changes)
[140] Fix | Delete
{
[141] Fix | Delete
return Utils::modifyRequest($request, $changes);
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
/**
[145] Fix | Delete
* Attempts to rewind a message body and throws an exception on failure.
[146] Fix | Delete
*
[147] Fix | Delete
* The body of the message will only be rewound if a call to `tell()` returns a
[148] Fix | Delete
* value other than `0`.
[149] Fix | Delete
*
[150] Fix | Delete
* @param MessageInterface $message Message to rewind
[151] Fix | Delete
*
[152] Fix | Delete
* @throws \RuntimeException
[153] Fix | Delete
*
[154] Fix | Delete
* @deprecated rewind_body will be removed in guzzlehttp/psr7:2.0. Use Message::rewindBody instead.
[155] Fix | Delete
*/
[156] Fix | Delete
function rewind_body(MessageInterface $message)
[157] Fix | Delete
{
[158] Fix | Delete
Message::rewindBody($message);
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* Safely opens a PHP stream resource using a filename.
[163] Fix | Delete
*
[164] Fix | Delete
* When fopen fails, PHP normally raises a warning. This function adds an
[165] Fix | Delete
* error handler that checks for errors and throws an exception instead.
[166] Fix | Delete
*
[167] Fix | Delete
* @param string $filename File to open
[168] Fix | Delete
* @param string $mode Mode used to open the file
[169] Fix | Delete
*
[170] Fix | Delete
* @return resource
[171] Fix | Delete
*
[172] Fix | Delete
* @throws \RuntimeException if the file cannot be opened
[173] Fix | Delete
*
[174] Fix | Delete
* @deprecated try_fopen will be removed in guzzlehttp/psr7:2.0. Use Utils::tryFopen instead.
[175] Fix | Delete
*/
[176] Fix | Delete
function try_fopen($filename, $mode)
[177] Fix | Delete
{
[178] Fix | Delete
return Utils::tryFopen($filename, $mode);
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
/**
[182] Fix | Delete
* Copy the contents of a stream into a string until the given number of
[183] Fix | Delete
* bytes have been read.
[184] Fix | Delete
*
[185] Fix | Delete
* @param StreamInterface $stream Stream to read
[186] Fix | Delete
* @param int $maxLen Maximum number of bytes to read. Pass -1
[187] Fix | Delete
* to read the entire stream.
[188] Fix | Delete
*
[189] Fix | Delete
* @return string
[190] Fix | Delete
*
[191] Fix | Delete
* @throws \RuntimeException on error.
[192] Fix | Delete
*
[193] Fix | Delete
* @deprecated copy_to_string will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToString instead.
[194] Fix | Delete
*/
[195] Fix | Delete
function copy_to_string(StreamInterface $stream, $maxLen = -1)
[196] Fix | Delete
{
[197] Fix | Delete
return Utils::copyToString($stream, $maxLen);
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
/**
[201] Fix | Delete
* Copy the contents of a stream into another stream until the given number
[202] Fix | Delete
* of bytes have been read.
[203] Fix | Delete
*
[204] Fix | Delete
* @param StreamInterface $source Stream to read from
[205] Fix | Delete
* @param StreamInterface $dest Stream to write to
[206] Fix | Delete
* @param int $maxLen Maximum number of bytes to read. Pass -1
[207] Fix | Delete
* to read the entire stream.
[208] Fix | Delete
*
[209] Fix | Delete
* @throws \RuntimeException on error.
[210] Fix | Delete
*
[211] Fix | Delete
* @deprecated copy_to_stream will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToStream instead.
[212] Fix | Delete
*/
[213] Fix | Delete
function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
[214] Fix | Delete
{
[215] Fix | Delete
return Utils::copyToStream($source, $dest, $maxLen);
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Calculate a hash of a stream.
[220] Fix | Delete
*
[221] Fix | Delete
* This method reads the entire stream to calculate a rolling hash, based on
[222] Fix | Delete
* PHP's `hash_init` functions.
[223] Fix | Delete
*
[224] Fix | Delete
* @param StreamInterface $stream Stream to calculate the hash for
[225] Fix | Delete
* @param string $algo Hash algorithm (e.g. md5, crc32, etc)
[226] Fix | Delete
* @param bool $rawOutput Whether or not to use raw output
[227] Fix | Delete
*
[228] Fix | Delete
* @return string Returns the hash of the stream
[229] Fix | Delete
*
[230] Fix | Delete
* @throws \RuntimeException on error.
[231] Fix | Delete
*
[232] Fix | Delete
* @deprecated hash will be removed in guzzlehttp/psr7:2.0. Use Utils::hash instead.
[233] Fix | Delete
*/
[234] Fix | Delete
function hash(StreamInterface $stream, $algo, $rawOutput = false)
[235] Fix | Delete
{
[236] Fix | Delete
return Utils::hash($stream, $algo, $rawOutput);
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
/**
[240] Fix | Delete
* Read a line from the stream up to the maximum allowed buffer length.
[241] Fix | Delete
*
[242] Fix | Delete
* @param StreamInterface $stream Stream to read from
[243] Fix | Delete
* @param int|null $maxLength Maximum buffer length
[244] Fix | Delete
*
[245] Fix | Delete
* @return string
[246] Fix | Delete
*
[247] Fix | Delete
* @deprecated readline will be removed in guzzlehttp/psr7:2.0. Use Utils::readLine instead.
[248] Fix | Delete
*/
[249] Fix | Delete
function readline(StreamInterface $stream, $maxLength = null)
[250] Fix | Delete
{
[251] Fix | Delete
return Utils::readLine($stream, $maxLength);
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
/**
[255] Fix | Delete
* Parses a request message string into a request object.
[256] Fix | Delete
*
[257] Fix | Delete
* @param string $message Request message string.
[258] Fix | Delete
*
[259] Fix | Delete
* @return Request
[260] Fix | Delete
*
[261] Fix | Delete
* @deprecated parse_request will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequest instead.
[262] Fix | Delete
*/
[263] Fix | Delete
function parse_request($message)
[264] Fix | Delete
{
[265] Fix | Delete
return Message::parseRequest($message);
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
/**
[269] Fix | Delete
* Parses a response message string into a response object.
[270] Fix | Delete
*
[271] Fix | Delete
* @param string $message Response message string.
[272] Fix | Delete
*
[273] Fix | Delete
* @return Response
[274] Fix | Delete
*
[275] Fix | Delete
* @deprecated parse_response will be removed in guzzlehttp/psr7:2.0. Use Message::parseResponse instead.
[276] Fix | Delete
*/
[277] Fix | Delete
function parse_response($message)
[278] Fix | Delete
{
[279] Fix | Delete
return Message::parseResponse($message);
[280] Fix | Delete
}
[281] Fix | Delete
[282] Fix | Delete
/**
[283] Fix | Delete
* Parse a query string into an associative array.
[284] Fix | Delete
*
[285] Fix | Delete
* If multiple values are found for the same key, the value of that key value
[286] Fix | Delete
* pair will become an array. This function does not parse nested PHP style
[287] Fix | Delete
* arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
[288] Fix | Delete
* into `['foo[a]' => '1', 'foo[b]' => '2'])`.
[289] Fix | Delete
*
[290] Fix | Delete
* @param string $str Query string to parse
[291] Fix | Delete
* @param int|bool $urlEncoding How the query string is encoded
[292] Fix | Delete
*
[293] Fix | Delete
* @return array
[294] Fix | Delete
*
[295] Fix | Delete
* @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead.
[296] Fix | Delete
*/
[297] Fix | Delete
function parse_query($str, $urlEncoding = true)
[298] Fix | Delete
{
[299] Fix | Delete
return Query::parse($str, $urlEncoding);
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
/**
[303] Fix | Delete
* Build a query string from an array of key value pairs.
[304] Fix | Delete
*
[305] Fix | Delete
* This function can use the return value of `parse_query()` to build a query
[306] Fix | Delete
* string. This function does not modify the provided keys when an array is
[307] Fix | Delete
* encountered (like `http_build_query()` would).
[308] Fix | Delete
*
[309] Fix | Delete
* @param array $params Query string parameters.
[310] Fix | Delete
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
[311] Fix | Delete
* to encode using RFC3986, or PHP_QUERY_RFC1738
[312] Fix | Delete
* to encode using RFC1738.
[313] Fix | Delete
*
[314] Fix | Delete
* @return string
[315] Fix | Delete
*
[316] Fix | Delete
* @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.
[317] Fix | Delete
*/
[318] Fix | Delete
function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
[319] Fix | Delete
{
[320] Fix | Delete
return Query::build($params, $encoding);
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
/**
[324] Fix | Delete
* Determines the mimetype of a file by looking at its extension.
[325] Fix | Delete
*
[326] Fix | Delete
* @param string $filename
[327] Fix | Delete
*
[328] Fix | Delete
* @return string|null
[329] Fix | Delete
*
[330] Fix | Delete
* @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead.
[331] Fix | Delete
*/
[332] Fix | Delete
function mimetype_from_filename($filename)
[333] Fix | Delete
{
[334] Fix | Delete
return MimeType::fromFilename($filename);
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
/**
[338] Fix | Delete
* Maps a file extensions to a mimetype.
[339] Fix | Delete
*
[340] Fix | Delete
* @param $extension string The file extension.
[341] Fix | Delete
*
[342] Fix | Delete
* @return string|null
[343] Fix | Delete
*
[344] Fix | Delete
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
[345] Fix | Delete
* @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead.
[346] Fix | Delete
*/
[347] Fix | Delete
function mimetype_from_extension($extension)
[348] Fix | Delete
{
[349] Fix | Delete
return MimeType::fromExtension($extension);
[350] Fix | Delete
}
[351] Fix | Delete
[352] Fix | Delete
/**
[353] Fix | Delete
* Parses an HTTP message into an associative array.
[354] Fix | Delete
*
[355] Fix | Delete
* The array contains the "start-line" key containing the start line of
[356] Fix | Delete
* the message, "headers" key containing an associative array of header
[357] Fix | Delete
* array values, and a "body" key containing the body of the message.
[358] Fix | Delete
*
[359] Fix | Delete
* @param string $message HTTP request or response to parse.
[360] Fix | Delete
*
[361] Fix | Delete
* @return array
[362] Fix | Delete
*
[363] Fix | Delete
* @internal
[364] Fix | Delete
*
[365] Fix | Delete
* @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead.
[366] Fix | Delete
*/
[367] Fix | Delete
function _parse_message($message)
[368] Fix | Delete
{
[369] Fix | Delete
return Message::parseMessage($message);
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* Constructs a URI for an HTTP request message.
[374] Fix | Delete
*
[375] Fix | Delete
* @param string $path Path from the start-line
[376] Fix | Delete
* @param array $headers Array of headers (each value an array).
[377] Fix | Delete
*
[378] Fix | Delete
* @return string
[379] Fix | Delete
*
[380] Fix | Delete
* @internal
[381] Fix | Delete
*
[382] Fix | Delete
* @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead.
[383] Fix | Delete
*/
[384] Fix | Delete
function _parse_request_uri($path, array $headers)
[385] Fix | Delete
{
[386] Fix | Delete
return Message::parseRequestUri($path, $headers);
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Get a short summary of the message body.
[391] Fix | Delete
*
[392] Fix | Delete
* Will return `null` if the response is not printable.
[393] Fix | Delete
*
[394] Fix | Delete
* @param MessageInterface $message The message to get the body summary
[395] Fix | Delete
* @param int $truncateAt The maximum allowed size of the summary
[396] Fix | Delete
*
[397] Fix | Delete
* @return string|null
[398] Fix | Delete
*
[399] Fix | Delete
* @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead.
[400] Fix | Delete
*/
[401] Fix | Delete
function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
[402] Fix | Delete
{
[403] Fix | Delete
return Message::bodySummary($message, $truncateAt);
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
/**
[407] Fix | Delete
* Remove the items given by the keys, case insensitively from the data.
[408] Fix | Delete
*
[409] Fix | Delete
* @param iterable<string> $keys
[410] Fix | Delete
*
[411] Fix | Delete
* @return array
[412] Fix | Delete
*
[413] Fix | Delete
* @internal
[414] Fix | Delete
*
[415] Fix | Delete
* @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead.
[416] Fix | Delete
*/
[417] Fix | Delete
function _caseless_remove($keys, array $data)
[418] Fix | Delete
{
[419] Fix | Delete
return Utils::caselessRemove($keys, $data);
[420] Fix | Delete
}
[421] Fix | Delete
[422] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function