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(static::SLOTS, array_keys($methods)) as $diff) {
            $methods[$diff] = [$stream, $diff];
        }

        return new self($methods);
    }
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(static::SLOTS, array_keys($methods)) as $diff) {
            $methods[$diff] = [$stream, $diff];
        }

        return new self($methods);
    }
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 ( static :: SLOTS , array_keys ( $ methods ) ) as $ diff ) { $ methods [ $ diff ] = [ $ stream , $ diff ] ; } return new self ( $ methods ) ; }
Adds custom functionality to an underlying stream by intercepting
specific method calls.

@param StreamInterface $stream  Stream to decorate
@param array           $methods Hash of method name to a closure

@return FnStream
Adds custom functionality to an underlying stream by intercepting specific method calls .