libs/StreamWrapper.php
public static function getResource(StreamInterface $stream)
    {
        self::register();

        if ($stream->isReadable()) {
            $mode = $stream->isWritable() ? 'r+' : 'r';
        } elseif ($stream->isWritable()) {
            $mode = 'w';
        } else {
            throw new \InvalidArgumentException('The stream must be readable, '
                .'writable, or both.');
        }

        return fopen('phmessage://stream', $mode, null, stream_context_create([
            'phmessage' => ['stream' => $stream],
        ]));
    }
public static function getResource(StreamInterface $stream)
    {
        self::register();

        if ($stream->isReadable()) {
            $mode = $stream->isWritable() ? 'r+' : 'r';
        } elseif ($stream->isWritable()) {
            $mode = 'w';
        } else {
            throw new \InvalidArgumentException('The stream must be readable, '
                .'writable, or both.');
        }

        return fopen('phmessage://stream', $mode, null, stream_context_create([
            'phmessage' => ['stream' => $stream],
        ]));
    }
public static function getResource ( StreamInterface $ stream ) { self :: register ( ) ; if ( $ stream -> isReadable ( ) ) { $ mode = $ stream -> isWritable ( ) ? 'r+' : 'r' ; } elseif ( $ stream -> isWritable ( ) ) { $ mode = 'w' ; } else { throw new \ InvalidArgumentException ( 'The stream must be readable, ' . 'writable, or both.' ) ; } return fopen ( 'phmessage://stream' , $ mode , null , stream_context_create ( [ 'phmessage' => [ 'stream' => $ stream ] , ] ) ) ; }
Returns a resource representing the stream.

@param StreamInterface $stream The stream to get a resource for

@return resource

@throws \InvalidArgumentException if stream is not readable or writable
Returns a resource representing the stream .