YoastSEO_Vendor\GuzzleHttp\Psr7
copy_to_string() Yoast 1.0
Copy the contents of a stream into a string until the given number of bytes have been read.
Хуков нет.
Возвращает
Строку.
Использование
copy_to_string( \YoastSEO_Vendor\Psr\Http\Message\StreamInterface $stream, $maxLen );
- $stream(Streamчислоerface) (обязательный)
- Stream to read
- $maxLen(число)
- Maximum number of bytes to read. Pass -1 to read the entire stream.
По умолчанию: -1
Код copy_to_string() copy to string Yoast 15.6.2
function copy_to_string(\YoastSEO_Vendor\Psr\Http\Message\StreamInterface $stream, $maxLen = -1)
{
$buffer = '';
if ($maxLen === -1) {
while (!$stream->eof()) {
$buf = $stream->read(1048576);
// Using a loose equality here to match on '' and false.
if ($buf == null) {
break;
}
$buffer .= $buf;
}
return $buffer;
}
$len = 0;
while (!$stream->eof() && $len < $maxLen) {
$buf = $stream->read($maxLen - $len);
// Using a loose equality here to match on '' and false.
if ($buf == null) {
break;
}
$buffer .= $buf;
$len = \strlen($buffer);
}
return $buffer;
}