YoastSEO_Vendor\GuzzleHttp\Psr7
copy_to_stream() Yoast 1.0
Copy the contents of a stream into another stream until the given number of bytes have been read.
Хуков нет.
Возвращает
Null. Ничего.
Использование
copy_to_stream( \YoastSEO_Vendor\Psr\Http\Message\StreamInterface $source, \YoastSEO_Vendor\Psr\Http\Message\StreamInterface $dest, $maxLen );
- $source(Streamчислоerface) (обязательный)
- Stream to read from
- $dest(Streamчислоerface) (обязательный)
- Stream to write to
- $maxLen(число)
- Maximum number of bytes to read. Pass -1 to read the entire stream.
По умолчанию: -1
Код copy_to_stream() copy to stream Yoast 15.6.2
function copy_to_stream(\YoastSEO_Vendor\Psr\Http\Message\StreamInterface $source, \YoastSEO_Vendor\Psr\Http\Message\StreamInterface $dest, $maxLen = -1)
{
$bufferSize = 8192;
if ($maxLen === -1) {
while (!$source->eof()) {
if (!$dest->write($source->read($bufferSize))) {
break;
}
}
} else {
$remaining = $maxLen;
while ($remaining > 0 && !$source->eof()) {
$buf = $source->read(\min($bufferSize, $remaining));
$len = \strlen($buf);
if (!$len) {
break;
}
$remaining -= $len;
$dest->write($buf);
}
}
}