Guzzle\Http\CachingEntityBody::rewind PHP Method

rewind() public method

public rewind ( )
    public function rewind()
    {
        return $this->seek(0);
    }

Usage Example

 public function testReadLinesFromBothStreams()
 {
     $this->body->seek($this->body->ftell());
     $this->body->write("test\n123\nhello\n1234567890\n");
     $this->body->rewind();
     $this->assertEquals("test\n", $this->body->readLine(7));
     $this->assertEquals("123\n", $this->body->readLine(7));
     $this->assertEquals("hello\n", $this->body->readLine(7));
     $this->assertEquals("123456", $this->body->readLine(7));
     $this->assertEquals("7890\n", $this->body->readLine(7));
     // We overwrote the decorated stream, so no more data
     $this->assertEquals('', $this->body->readLine(7));
 }