public function withLocalScope()
    {
        if ($this->isClosed()) {
            throw new \RuntimeException("The stream is closed");
        }
        
        if (!$this->isGlobal()) {
            return $this;
        }
        
        $stream = clone $this;
        
        fwrite($stream->handle, (string)$this);
        
        return $stream;
    }
public function withLocalScope()
    {
        if ($this->isClosed()) {
            throw new \RuntimeException("The stream is closed");
        }
        
        if (!$this->isGlobal()) {
            return $this;
        }
        
        $stream = clone $this;
        
        fwrite($stream->handle, (string)$this);
        
        return $stream;
    }
public function withLocalScope ( ) { if ( $ this -> isClosed ( ) ) { throw new \ RuntimeException ( "The stream is closed" ) ; } if ( ! $ this -> isGlobal ( ) ) { return $ this ; } $ stream = clone $ this ; fwrite ( $ stream -> handle , ( string ) $ this ) ; return $ stream ; }
Get this stream in a local scope.
If the stream is global, it will create a temp stream and copy the contents.

@return OutputBufferStream
@throws \RuntimeException
Get this stream in a local scope . If the stream is global it will create a temp stream and copy the contents .