src/Storage/Memory.php
public function getStream(string $mode = 'r+')
    {
        if (!in_array($mode, ['r+','w','w+','a+','x','x+','c+',true])) {
            throw new RuntimeException(sprintf('unable to open stream for memory-storage in non-write mode "%s"', $mode), 500);
        }

        $stream = \fopen('php://memory', $mode);

        if ($stream === false) {
            throw new RuntimeException('failed to open stream', 500);
        }

        // pre-fill stream
        if ($this->content !== null) {
            \fwrite($stream, $this->content);
            \rewind($stream);
        }
        return $stream;
    }
public function getStream(string $mode = 'r+')
    {
        if (!in_array($mode, ['r+','w','w+','a+','x','x+','c+',true])) {
            throw new RuntimeException(sprintf('unable to open stream for memory-storage in non-write mode "%s"', $mode), 500);
        }

        $stream = \fopen('php://memory', $mode);

        if ($stream === false) {
            throw new RuntimeException('failed to open stream', 500);
        }

        // pre-fill stream
        if ($this->content !== null) {
            \fwrite($stream, $this->content);
            \rewind($stream);
        }
        return $stream;
    }
public function getStream ( string $ mode = 'r+' ) { if ( ! in_array ( $ mode , [ 'r+' , 'w' , 'w+' , 'a+' , 'x' , 'x+' , 'c+' , true ] ) ) { throw new RuntimeException ( sprintf ( 'unable to open stream for memory-storage in non-write mode "%s"' , $ mode ) , 500 ) ; } $ stream = \ fopen ( 'php://memory' , $ mode ) ; if ( $ stream === false ) { throw new RuntimeException ( 'failed to open stream' , 500 ) ; } // pre-fill stream if ( $ this -> content !== null ) { \ fwrite ( $ stream , $ this -> content ) ; \ rewind ( $ stream ) ; } return $ stream ; }
this stream is <b>READONLY!</b>
@inheritDoc
@throws RuntimeException
this stream is <b > READONLY!< / b >