Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../vendor/guzzleht.../psr7
File: README.md
# PSR-7 Message Implementation
[0] Fix | Delete
[1] Fix | Delete
This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/)
[2] Fix | Delete
message implementation, several stream decorators, and some helpful
[3] Fix | Delete
functionality like query string parsing.
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7)
[7] Fix | Delete
[8] Fix | Delete
[9] Fix | Delete
# Stream implementation
[10] Fix | Delete
[11] Fix | Delete
This package comes with a number of stream implementations and stream
[12] Fix | Delete
decorators.
[13] Fix | Delete
[14] Fix | Delete
[15] Fix | Delete
## AppendStream
[16] Fix | Delete
[17] Fix | Delete
`GuzzleHttp\Psr7\AppendStream`
[18] Fix | Delete
[19] Fix | Delete
Reads from multiple streams, one after the other.
[20] Fix | Delete
[21] Fix | Delete
```php
[22] Fix | Delete
use GuzzleHttp\Psr7;
[23] Fix | Delete
[24] Fix | Delete
$a = Psr7\Utils::streamFor('abc, ');
[25] Fix | Delete
$b = Psr7\Utils::streamFor('123.');
[26] Fix | Delete
$composed = new Psr7\AppendStream([$a, $b]);
[27] Fix | Delete
[28] Fix | Delete
$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me'));
[29] Fix | Delete
[30] Fix | Delete
echo $composed; // abc, 123. Above all listen to me.
[31] Fix | Delete
```
[32] Fix | Delete
[33] Fix | Delete
[34] Fix | Delete
## BufferStream
[35] Fix | Delete
[36] Fix | Delete
`GuzzleHttp\Psr7\BufferStream`
[37] Fix | Delete
[38] Fix | Delete
Provides a buffer stream that can be written to fill a buffer, and read
[39] Fix | Delete
from to remove bytes from the buffer.
[40] Fix | Delete
[41] Fix | Delete
This stream returns a "hwm" metadata value that tells upstream consumers
[42] Fix | Delete
what the configured high water mark of the stream is, or the maximum
[43] Fix | Delete
preferred size of the buffer.
[44] Fix | Delete
[45] Fix | Delete
```php
[46] Fix | Delete
use GuzzleHttp\Psr7;
[47] Fix | Delete
[48] Fix | Delete
// When more than 1024 bytes are in the buffer, it will begin returning
[49] Fix | Delete
// false to writes. This is an indication that writers should slow down.
[50] Fix | Delete
$buffer = new Psr7\BufferStream(1024);
[51] Fix | Delete
```
[52] Fix | Delete
[53] Fix | Delete
[54] Fix | Delete
## CachingStream
[55] Fix | Delete
[56] Fix | Delete
The CachingStream is used to allow seeking over previously read bytes on
[57] Fix | Delete
non-seekable streams. This can be useful when transferring a non-seekable
[58] Fix | Delete
entity body fails due to needing to rewind the stream (for example, resulting
[59] Fix | Delete
from a redirect). Data that is read from the remote stream will be buffered in
[60] Fix | Delete
a PHP temp stream so that previously read bytes are cached first in memory,
[61] Fix | Delete
then on disk.
[62] Fix | Delete
[63] Fix | Delete
```php
[64] Fix | Delete
use GuzzleHttp\Psr7;
[65] Fix | Delete
[66] Fix | Delete
$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r'));
[67] Fix | Delete
$stream = new Psr7\CachingStream($original);
[68] Fix | Delete
[69] Fix | Delete
$stream->read(1024);
[70] Fix | Delete
echo $stream->tell();
[71] Fix | Delete
// 1024
[72] Fix | Delete
[73] Fix | Delete
$stream->seek(0);
[74] Fix | Delete
echo $stream->tell();
[75] Fix | Delete
// 0
[76] Fix | Delete
```
[77] Fix | Delete
[78] Fix | Delete
[79] Fix | Delete
## DroppingStream
[80] Fix | Delete
[81] Fix | Delete
`GuzzleHttp\Psr7\DroppingStream`
[82] Fix | Delete
[83] Fix | Delete
Stream decorator that begins dropping data once the size of the underlying
[84] Fix | Delete
stream becomes too full.
[85] Fix | Delete
[86] Fix | Delete
```php
[87] Fix | Delete
use GuzzleHttp\Psr7;
[88] Fix | Delete
[89] Fix | Delete
// Create an empty stream
[90] Fix | Delete
$stream = Psr7\Utils::streamFor();
[91] Fix | Delete
[92] Fix | Delete
// Start dropping data when the stream has more than 10 bytes
[93] Fix | Delete
$dropping = new Psr7\DroppingStream($stream, 10);
[94] Fix | Delete
[95] Fix | Delete
$dropping->write('01234567890123456789');
[96] Fix | Delete
echo $stream; // 0123456789
[97] Fix | Delete
```
[98] Fix | Delete
[99] Fix | Delete
[100] Fix | Delete
## FnStream
[101] Fix | Delete
[102] Fix | Delete
`GuzzleHttp\Psr7\FnStream`
[103] Fix | Delete
[104] Fix | Delete
Compose stream implementations based on a hash of functions.
[105] Fix | Delete
[106] Fix | Delete
Allows for easy testing and extension of a provided stream without needing
[107] Fix | Delete
to create a concrete class for a simple extension point.
[108] Fix | Delete
[109] Fix | Delete
```php
[110] Fix | Delete
[111] Fix | Delete
use GuzzleHttp\Psr7;
[112] Fix | Delete
[113] Fix | Delete
$stream = Psr7\Utils::streamFor('hi');
[114] Fix | Delete
$fnStream = Psr7\FnStream::decorate($stream, [
[115] Fix | Delete
'rewind' => function () use ($stream) {
[116] Fix | Delete
echo 'About to rewind - ';
[117] Fix | Delete
$stream->rewind();
[118] Fix | Delete
echo 'rewound!';
[119] Fix | Delete
}
[120] Fix | Delete
]);
[121] Fix | Delete
[122] Fix | Delete
$fnStream->rewind();
[123] Fix | Delete
// Outputs: About to rewind - rewound!
[124] Fix | Delete
```
[125] Fix | Delete
[126] Fix | Delete
[127] Fix | Delete
## InflateStream
[128] Fix | Delete
[129] Fix | Delete
`GuzzleHttp\Psr7\InflateStream`
[130] Fix | Delete
[131] Fix | Delete
Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
[132] Fix | Delete
[133] Fix | Delete
This stream decorator skips the first 10 bytes of the given stream to remove
[134] Fix | Delete
the gzip header, converts the provided stream to a PHP stream resource,
[135] Fix | Delete
then appends the zlib.inflate filter. The stream is then converted back
[136] Fix | Delete
to a Guzzle stream resource to be used as a Guzzle stream.
[137] Fix | Delete
[138] Fix | Delete
[139] Fix | Delete
## LazyOpenStream
[140] Fix | Delete
[141] Fix | Delete
`GuzzleHttp\Psr7\LazyOpenStream`
[142] Fix | Delete
[143] Fix | Delete
Lazily reads or writes to a file that is opened only after an IO operation
[144] Fix | Delete
take place on the stream.
[145] Fix | Delete
[146] Fix | Delete
```php
[147] Fix | Delete
use GuzzleHttp\Psr7;
[148] Fix | Delete
[149] Fix | Delete
$stream = new Psr7\LazyOpenStream('/path/to/file', 'r');
[150] Fix | Delete
// The file has not yet been opened...
[151] Fix | Delete
[152] Fix | Delete
echo $stream->read(10);
[153] Fix | Delete
// The file is opened and read from only when needed.
[154] Fix | Delete
```
[155] Fix | Delete
[156] Fix | Delete
[157] Fix | Delete
## LimitStream
[158] Fix | Delete
[159] Fix | Delete
`GuzzleHttp\Psr7\LimitStream`
[160] Fix | Delete
[161] Fix | Delete
LimitStream can be used to read a subset or slice of an existing stream object.
[162] Fix | Delete
This can be useful for breaking a large file into smaller pieces to be sent in
[163] Fix | Delete
chunks (e.g. Amazon S3's multipart upload API).
[164] Fix | Delete
[165] Fix | Delete
```php
[166] Fix | Delete
use GuzzleHttp\Psr7;
[167] Fix | Delete
[168] Fix | Delete
$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+'));
[169] Fix | Delete
echo $original->getSize();
[170] Fix | Delete
// >>> 1048576
[171] Fix | Delete
[172] Fix | Delete
// Limit the size of the body to 1024 bytes and start reading from byte 2048
[173] Fix | Delete
$stream = new Psr7\LimitStream($original, 1024, 2048);
[174] Fix | Delete
echo $stream->getSize();
[175] Fix | Delete
// >>> 1024
[176] Fix | Delete
echo $stream->tell();
[177] Fix | Delete
// >>> 0
[178] Fix | Delete
```
[179] Fix | Delete
[180] Fix | Delete
[181] Fix | Delete
## MultipartStream
[182] Fix | Delete
[183] Fix | Delete
`GuzzleHttp\Psr7\MultipartStream`
[184] Fix | Delete
[185] Fix | Delete
Stream that when read returns bytes for a streaming multipart or
[186] Fix | Delete
multipart/form-data stream.
[187] Fix | Delete
[188] Fix | Delete
[189] Fix | Delete
## NoSeekStream
[190] Fix | Delete
[191] Fix | Delete
`GuzzleHttp\Psr7\NoSeekStream`
[192] Fix | Delete
[193] Fix | Delete
NoSeekStream wraps a stream and does not allow seeking.
[194] Fix | Delete
[195] Fix | Delete
```php
[196] Fix | Delete
use GuzzleHttp\Psr7;
[197] Fix | Delete
[198] Fix | Delete
$original = Psr7\Utils::streamFor('foo');
[199] Fix | Delete
$noSeek = new Psr7\NoSeekStream($original);
[200] Fix | Delete
[201] Fix | Delete
echo $noSeek->read(3);
[202] Fix | Delete
// foo
[203] Fix | Delete
var_export($noSeek->isSeekable());
[204] Fix | Delete
// false
[205] Fix | Delete
$noSeek->seek(0);
[206] Fix | Delete
var_export($noSeek->read(3));
[207] Fix | Delete
// NULL
[208] Fix | Delete
```
[209] Fix | Delete
[210] Fix | Delete
[211] Fix | Delete
## PumpStream
[212] Fix | Delete
[213] Fix | Delete
`GuzzleHttp\Psr7\PumpStream`
[214] Fix | Delete
[215] Fix | Delete
Provides a read only stream that pumps data from a PHP callable.
[216] Fix | Delete
[217] Fix | Delete
When invoking the provided callable, the PumpStream will pass the amount of
[218] Fix | Delete
data requested to read to the callable. The callable can choose to ignore
[219] Fix | Delete
this value and return fewer or more bytes than requested. Any extra data
[220] Fix | Delete
returned by the provided callable is buffered internally until drained using
[221] Fix | Delete
the read() function of the PumpStream. The provided callable MUST return
[222] Fix | Delete
false when there is no more data to read.
[223] Fix | Delete
[224] Fix | Delete
[225] Fix | Delete
## Implementing stream decorators
[226] Fix | Delete
[227] Fix | Delete
Creating a stream decorator is very easy thanks to the
[228] Fix | Delete
`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that
[229] Fix | Delete
implement `Psr\Http\Message\StreamInterface` by proxying to an underlying
[230] Fix | Delete
stream. Just `use` the `StreamDecoratorTrait` and implement your custom
[231] Fix | Delete
methods.
[232] Fix | Delete
[233] Fix | Delete
For example, let's say we wanted to call a specific function each time the last
[234] Fix | Delete
byte is read from a stream. This could be implemented by overriding the
[235] Fix | Delete
`read()` method.
[236] Fix | Delete
[237] Fix | Delete
```php
[238] Fix | Delete
use Psr\Http\Message\StreamInterface;
[239] Fix | Delete
use GuzzleHttp\Psr7\StreamDecoratorTrait;
[240] Fix | Delete
[241] Fix | Delete
class EofCallbackStream implements StreamInterface
[242] Fix | Delete
{
[243] Fix | Delete
use StreamDecoratorTrait;
[244] Fix | Delete
[245] Fix | Delete
private $callback;
[246] Fix | Delete
[247] Fix | Delete
public function __construct(StreamInterface $stream, callable $cb)
[248] Fix | Delete
{
[249] Fix | Delete
$this->stream = $stream;
[250] Fix | Delete
$this->callback = $cb;
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
public function read($length)
[254] Fix | Delete
{
[255] Fix | Delete
$result = $this->stream->read($length);
[256] Fix | Delete
[257] Fix | Delete
// Invoke the callback when EOF is hit.
[258] Fix | Delete
if ($this->eof()) {
[259] Fix | Delete
call_user_func($this->callback);
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
return $result;
[263] Fix | Delete
}
[264] Fix | Delete
}
[265] Fix | Delete
```
[266] Fix | Delete
[267] Fix | Delete
This decorator could be added to any existing stream and used like so:
[268] Fix | Delete
[269] Fix | Delete
```php
[270] Fix | Delete
use GuzzleHttp\Psr7;
[271] Fix | Delete
[272] Fix | Delete
$original = Psr7\Utils::streamFor('foo');
[273] Fix | Delete
[274] Fix | Delete
$eofStream = new EofCallbackStream($original, function () {
[275] Fix | Delete
echo 'EOF!';
[276] Fix | Delete
});
[277] Fix | Delete
[278] Fix | Delete
$eofStream->read(2);
[279] Fix | Delete
$eofStream->read(1);
[280] Fix | Delete
// echoes "EOF!"
[281] Fix | Delete
$eofStream->seek(0);
[282] Fix | Delete
$eofStream->read(3);
[283] Fix | Delete
// echoes "EOF!"
[284] Fix | Delete
```
[285] Fix | Delete
[286] Fix | Delete
[287] Fix | Delete
## PHP StreamWrapper
[288] Fix | Delete
[289] Fix | Delete
You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a
[290] Fix | Delete
PSR-7 stream as a PHP stream resource.
[291] Fix | Delete
[292] Fix | Delete
Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP
[293] Fix | Delete
stream from a PSR-7 stream.
[294] Fix | Delete
[295] Fix | Delete
```php
[296] Fix | Delete
use GuzzleHttp\Psr7\StreamWrapper;
[297] Fix | Delete
[298] Fix | Delete
$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!');
[299] Fix | Delete
$resource = StreamWrapper::getResource($stream);
[300] Fix | Delete
echo fread($resource, 6); // outputs hello!
[301] Fix | Delete
```
[302] Fix | Delete
[303] Fix | Delete
[304] Fix | Delete
# Static API
[305] Fix | Delete
[306] Fix | Delete
There are various static methods available under the `GuzzleHttp\Psr7` namespace.
[307] Fix | Delete
[308] Fix | Delete
[309] Fix | Delete
## `GuzzleHttp\Psr7\Message::toString`
[310] Fix | Delete
[311] Fix | Delete
`public static function toString(MessageInterface $message): string`
[312] Fix | Delete
[313] Fix | Delete
Returns the string representation of an HTTP message.
[314] Fix | Delete
[315] Fix | Delete
```php
[316] Fix | Delete
$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com');
[317] Fix | Delete
echo GuzzleHttp\Psr7\Message::toString($request);
[318] Fix | Delete
```
[319] Fix | Delete
[320] Fix | Delete
[321] Fix | Delete
## `GuzzleHttp\Psr7\Message::bodySummary`
[322] Fix | Delete
[323] Fix | Delete
`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null`
[324] Fix | Delete
[325] Fix | Delete
Get a short summary of the message body.
[326] Fix | Delete
[327] Fix | Delete
Will return `null` if the response is not printable.
[328] Fix | Delete
[329] Fix | Delete
[330] Fix | Delete
## `GuzzleHttp\Psr7\Message::rewindBody`
[331] Fix | Delete
[332] Fix | Delete
`public static function rewindBody(MessageInterface $message): void`
[333] Fix | Delete
[334] Fix | Delete
Attempts to rewind a message body and throws an exception on failure.
[335] Fix | Delete
[336] Fix | Delete
The body of the message will only be rewound if a call to `tell()`
[337] Fix | Delete
returns a value other than `0`.
[338] Fix | Delete
[339] Fix | Delete
[340] Fix | Delete
## `GuzzleHttp\Psr7\Message::parseMessage`
[341] Fix | Delete
[342] Fix | Delete
`public static function parseMessage(string $message): array`
[343] Fix | Delete
[344] Fix | Delete
Parses an HTTP message into an associative array.
[345] Fix | Delete
[346] Fix | Delete
The array contains the "start-line" key containing the start line of
[347] Fix | Delete
the message, "headers" key containing an associative array of header
[348] Fix | Delete
array values, and a "body" key containing the body of the message.
[349] Fix | Delete
[350] Fix | Delete
[351] Fix | Delete
## `GuzzleHttp\Psr7\Message::parseRequestUri`
[352] Fix | Delete
[353] Fix | Delete
`public static function parseRequestUri(string $path, array $headers): string`
[354] Fix | Delete
[355] Fix | Delete
Constructs a URI for an HTTP request message.
[356] Fix | Delete
[357] Fix | Delete
[358] Fix | Delete
## `GuzzleHttp\Psr7\Message::parseRequest`
[359] Fix | Delete
[360] Fix | Delete
`public static function parseRequest(string $message): Request`
[361] Fix | Delete
[362] Fix | Delete
Parses a request message string into a request object.
[363] Fix | Delete
[364] Fix | Delete
[365] Fix | Delete
## `GuzzleHttp\Psr7\Message::parseResponse`
[366] Fix | Delete
[367] Fix | Delete
`public static function parseResponse(string $message): Response`
[368] Fix | Delete
[369] Fix | Delete
Parses a response message string into a response object.
[370] Fix | Delete
[371] Fix | Delete
[372] Fix | Delete
## `GuzzleHttp\Psr7\Header::parse`
[373] Fix | Delete
[374] Fix | Delete
`public static function parse(string|array $header): array`
[375] Fix | Delete
[376] Fix | Delete
Parse an array of header values containing ";" separated data into an
[377] Fix | Delete
array of associative arrays representing the header key value pair data
[378] Fix | Delete
of the header. When a parameter does not contain a value, but just
[379] Fix | Delete
contains a key, this function will inject a key with a '' string value.
[380] Fix | Delete
[381] Fix | Delete
[382] Fix | Delete
## `GuzzleHttp\Psr7\Header::normalize`
[383] Fix | Delete
[384] Fix | Delete
`public static function normalize(string|array $header): array`
[385] Fix | Delete
[386] Fix | Delete
Converts an array of header values that may contain comma separated
[387] Fix | Delete
headers into an array of headers with no comma separated values.
[388] Fix | Delete
[389] Fix | Delete
[390] Fix | Delete
## `GuzzleHttp\Psr7\Query::parse`
[391] Fix | Delete
[392] Fix | Delete
`public static function parse(string $str, int|bool $urlEncoding = true): array`
[393] Fix | Delete
[394] Fix | Delete
Parse a query string into an associative array.
[395] Fix | Delete
[396] Fix | Delete
If multiple values are found for the same key, the value of that key
[397] Fix | Delete
value pair will become an array. This function does not parse nested
[398] Fix | Delete
PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2`
[399] Fix | Delete
will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`.
[400] Fix | Delete
[401] Fix | Delete
[402] Fix | Delete
## `GuzzleHttp\Psr7\Query::build`
[403] Fix | Delete
[404] Fix | Delete
`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string`
[405] Fix | Delete
[406] Fix | Delete
Build a query string from an array of key value pairs.
[407] Fix | Delete
[408] Fix | Delete
This function can use the return value of `parse()` to build a query
[409] Fix | Delete
string. This function does not modify the provided keys when an array is
[410] Fix | Delete
encountered (like `http_build_query()` would).
[411] Fix | Delete
[412] Fix | Delete
[413] Fix | Delete
## `GuzzleHttp\Psr7\Utils::caselessRemove`
[414] Fix | Delete
[415] Fix | Delete
`public static function caselessRemove(iterable<string> $keys, $keys, array $data): array`
[416] Fix | Delete
[417] Fix | Delete
Remove the items given by the keys, case insensitively from the data.
[418] Fix | Delete
[419] Fix | Delete
[420] Fix | Delete
## `GuzzleHttp\Psr7\Utils::copyToStream`
[421] Fix | Delete
[422] Fix | Delete
`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void`
[423] Fix | Delete
[424] Fix | Delete
Copy the contents of a stream into another stream until the given number
[425] Fix | Delete
of bytes have been read.
[426] Fix | Delete
[427] Fix | Delete
[428] Fix | Delete
## `GuzzleHttp\Psr7\Utils::copyToString`
[429] Fix | Delete
[430] Fix | Delete
`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string`
[431] Fix | Delete
[432] Fix | Delete
Copy the contents of a stream into a string until the given number of
[433] Fix | Delete
bytes have been read.
[434] Fix | Delete
[435] Fix | Delete
[436] Fix | Delete
## `GuzzleHttp\Psr7\Utils::hash`
[437] Fix | Delete
[438] Fix | Delete
`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string`
[439] Fix | Delete
[440] Fix | Delete
Calculate a hash of a stream.
[441] Fix | Delete
[442] Fix | Delete
This method reads the entire stream to calculate a rolling hash, based on
[443] Fix | Delete
PHP's `hash_init` functions.
[444] Fix | Delete
[445] Fix | Delete
[446] Fix | Delete
## `GuzzleHttp\Psr7\Utils::modifyRequest`
[447] Fix | Delete
[448] Fix | Delete
`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface`
[449] Fix | Delete
[450] Fix | Delete
Clone and modify a request with the given changes.
[451] Fix | Delete
[452] Fix | Delete
This method is useful for reducing the number of clones needed to mutate
[453] Fix | Delete
a message.
[454] Fix | Delete
[455] Fix | Delete
- method: (string) Changes the HTTP method.
[456] Fix | Delete
- set_headers: (array) Sets the given headers.
[457] Fix | Delete
- remove_headers: (array) Remove the given headers.
[458] Fix | Delete
- body: (mixed) Sets the given body.
[459] Fix | Delete
- uri: (UriInterface) Set the URI.
[460] Fix | Delete
- query: (string) Set the query string value of the URI.
[461] Fix | Delete
- version: (string) Set the protocol version.
[462] Fix | Delete
[463] Fix | Delete
[464] Fix | Delete
## `GuzzleHttp\Psr7\Utils::readLine`
[465] Fix | Delete
[466] Fix | Delete
`public static function readLine(StreamInterface $stream, int $maxLength = null): string`
[467] Fix | Delete
[468] Fix | Delete
Read a line from the stream up to the maximum allowed buffer length.
[469] Fix | Delete
[470] Fix | Delete
[471] Fix | Delete
## `GuzzleHttp\Psr7\Utils::streamFor`
[472] Fix | Delete
[473] Fix | Delete
`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface`
[474] Fix | Delete
[475] Fix | Delete
Create a new stream based on the input type.
[476] Fix | Delete
[477] Fix | Delete
Options is an associative array that can contain the following keys:
[478] Fix | Delete
[479] Fix | Delete
- metadata: Array of custom metadata.
[480] Fix | Delete
- size: Size of the stream.
[481] Fix | Delete
[482] Fix | Delete
This method accepts the following `$resource` types:
[483] Fix | Delete
[484] Fix | Delete
- `Psr\Http\Message\StreamInterface`: Returns the value as-is.
[485] Fix | Delete
- `string`: Creates a stream object that uses the given string as the contents.
[486] Fix | Delete
- `resource`: Creates a stream object that wraps the given PHP stream resource.
[487] Fix | Delete
- `Iterator`: If the provided value implements `Iterator`, then a read-only
[488] Fix | Delete
stream object will be created that wraps the given iterable. Each time the
[489] Fix | Delete
stream is read from, data from the iterator will fill a buffer and will be
[490] Fix | Delete
continuously called until the buffer is equal to the requested read size.
[491] Fix | Delete
Subsequent read calls will first read from the buffer and then call `next`
[492] Fix | Delete
on the underlying iterator until it is exhausted.
[493] Fix | Delete
- `object` with `__toString()`: If the object has the `__toString()` method,
[494] Fix | Delete
the object will be cast to a string and then a stream will be returned that
[495] Fix | Delete
uses the string value.
[496] Fix | Delete
- `NULL`: When `null` is passed, an empty stream object is returned.
[497] Fix | Delete
- `callable` When a callable is passed, a read-only stream object will be
[498] Fix | Delete
created that invokes the given callable. The callable is invoked with the
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function