<?php stream_get_meta_data(resource $stream): array
<?php $this->givenWeHaveAnExistingFile('path.txt'); $resource = $adapter->readStream('path.txt'); $metadata = stream_get_meta_data($resource); fclose($resource); $this->assertTrue($metadata['seekable']);
<?php $this->givenWeHaveAnExistingFile('path.txt'); $resource = $adapter->readStream('path.txt'); $metadata = stream_get_meta_data($resource); fclose($resource); $this->assertEquals($seekable, $metadata['seekable']);
<?php private function rewindStream($resource): void { if (ftell($resource) !== 0 && stream_get_meta_data($resource)['seekable']) { rewind($resource); } }