Webmozart\Console\IO\InputStream\StringInputStream::clear PHP Method

clear() public method

Clears the contents of the buffer.
public clear ( )
    public function clear()
    {
        ftruncate($this->stream, 0);
        rewind($this->stream);
    }

Usage Example

Exemplo n.º 1
0
 public function testClear()
 {
     $stream = new StringInputStream(self::LOREM_IPSUM);
     $this->assertSame("Lorem ipsum dolor sit amet,\n", $stream->readLine());
     $stream->clear();
     $this->assertNull($stream->readLine());
 }