public static function FnStream::decorate in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/psr7/src/FnStream.php \GuzzleHttp\Psr7\FnStream::decorate()
Adds custom functionality to an underlying stream by intercepting specific method calls.
Parameters
StreamInterface $stream Stream to decorate:
array $methods Hash of method name to a closure:
Return value
7 calls to FnStream::decorate()
- FnStreamTest::testDecoratesStream in vendor/
guzzlehttp/ psr7/ tests/ FnStreamTest.php - FnStreamTest::testDecoratesWithCustomizations in vendor/
guzzlehttp/ psr7/ tests/ FnStreamTest.php - FunctionsTest::testCopiesToStringStopsWhenReadFails in vendor/
guzzlehttp/ psr7/ tests/ FunctionsTest.php - FunctionsTest::testStopsCopyToSteamWhenReadFailsWithMaxLen in vendor/
guzzlehttp/ psr7/ tests/ FunctionsTest.php - FunctionsTest::testStopsCopyToSteamWhenWriteFailsWithMaxLen in vendor/
guzzlehttp/ psr7/ tests/ FunctionsTest.php
File
- vendor/
guzzlehttp/ psr7/ src/ FnStream.php, line 64
Class
- FnStream
- Compose stream implementations based on a hash of functions.
Namespace
GuzzleHttp\Psr7Code
public static function decorate(StreamInterface $stream, array $methods) {
// If any of the required methods were not provided, then simply
// proxy to the decorated stream.
foreach (array_diff(self::$slots, array_keys($methods)) as $diff) {
$methods[$diff] = [
$stream,
$diff,
];
}
return new self($methods);
}