Phly\Http\Stream::tell PHP Method

tell() public method

public tell ( )
    public function tell()
    {
        if (!$this->resource) {
            throw new RuntimeException('No resource available; cannot tell position');
        }
        $result = ftell($this->resource);
        if (!is_int($result)) {
            throw new RuntimeException('Error occurred during tell operation');
        }
        return $result;
    }

Usage Example

Exemplo n.º 1
0
 public function testRewindResetsToStartOfStream()
 {
     $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly');
     file_put_contents($this->tmpnam, 'FOO BAR');
     $resource = fopen($this->tmpnam, 'wb+');
     $stream = new Stream($resource);
     $this->assertTrue($stream->seek(2));
     $stream->rewind();
     $this->assertEquals(0, $stream->tell());
 }