public function parse($handleOrString)
    {
        $stream = Psr7\stream_for($handleOrString);
        $copy = Psr7\stream_for(fopen('php://temp', 'r+'));

        Psr7\copy_to_stream($stream, $copy);
        $copy->rewind();

        // don't close it when $stream gets destroyed
        $stream->detach();
        $parser = $this->di->newMessageParser();
        return $parser->parse($copy);
    }
public function parse($handleOrString)
    {
        $stream = Psr7\stream_for($handleOrString);
        $copy = Psr7\stream_for(fopen('php://temp', 'r+'));

        Psr7\copy_to_stream($stream, $copy);
        $copy->rewind();

        // don't close it when $stream gets destroyed
        $stream->detach();
        $parser = $this->di->newMessageParser();
        return $parser->parse($copy);
    }
public function parse ( $ handleOrString ) { $ stream = Psr7 \ stream_for ( $ handleOrString ) ; $ copy = Psr7 \ stream_for ( fopen ( 'php://temp' , 'r+' ) ) ; Psr7 \ copy_to_stream ( $ stream , $ copy ) ; $ copy -> rewind ( ) ; // don't close it when $stream gets destroyed $ stream -> detach ( ) ; $ parser = $ this -> di -> newMessageParser ( ) ; return $ parser -> parse ( $ copy ) ; }
Parses the passed stream handle into a ZBateson\MailMimeParser\Message
object and returns it.

Internally, the message is first copied to a temp stream (with php://temp
which may keep it in memory or write it to disk) and its stream is used.
That way if the message is too large to hold in memory it can be written
to a temporary file if need be.

@param resource|string $handleOrString the resource handle to the input
stream of the mime message, or a string containing a mime message
@return \ZBateson\MailMimeParser\Message
Parses the passed stream handle into a ZBateson \ MailMimeParser \ Message object and returns it .