stream_get_meta_data

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Retrieves header/meta data from streams/file pointers
<?php stream_get_meta_data(resource $stream): array
<?php         $tmpFile = tmpfile();



        parent::__construct(stream_get_meta_data($tmpFile)['uri'], $this->path);
<?php     {

        stream_copy_to_stream($this->storage->readStream($this->path), $tmpFile = tmpfile());



        return @getimagesize(stream_get_meta_data($tmpFile)['uri']);

    }



    public function temporaryUrl()
<?php     protected function tempFilePath()

    {

        return stream_get_meta_data($this->tempFile)['uri'];

    }

}
<?php     protected function dump($value)

    {

        $outputFile = stream_get_meta_data(tmpfile())['uri'];



        $dumper = new HtmlDumper(

            '/my-work-directory',
<?php     {

        $this->fails(

            File::image()->dimensions(Rule::dimensions()->width(100)->height(100)),

            new UploadedFileWithCustomImageSizeMethod(stream_get_meta_data($tmpFile = tmpfile())['uri'], 'foo.png'),

            ['validation.dimensions'],

        );
<?php         $this->passes(

            File::image()->dimensions(Rule::dimensions()->width(200)->height(200)),

            new UploadedFileWithCustomImageSizeMethod(stream_get_meta_data($tmpFile = tmpfile())['uri'], 'foo.png'),

        );

    }
<?php                 }



                $handle = $this->createTemporaryFile();

                $path   = stream_get_meta_data($handle)['uri'];



                $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY);
<?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         $this->givenWeHaveAnExistingFile('path.txt');



        $resource = $adapter->readStream('path.txt');

        $metadata = stream_get_meta_data($resource);

        fclose($resource);



        $this->assertTrue($metadata['seekable']);
<?php     private function rewindStream($resource): void

    {

        if (ftell($resource) !== 0 && stream_get_meta_data($resource)['seekable']) {

            rewind($resource);

        }

    }
<?php         $fp = tmpfile();

        fwrite($fp, $yaml);

        $path = stream_get_meta_data($fp)['uri'];



        $this->assertEqualsIgnoringLineEndings(

            ['foo' => 'bar', 'content' => 'some content'],
<?php             );

        }



        $meta = \stream_get_meta_data($this->master);

        if (!isset($meta['stream_type']) || $meta['stream_type'] !== 'tcp_socket') {

            \fclose($this->master);
<?php         $this->assertInstanceOf('React\Socket\Connection', $client);

        $this->assertTrue(isset($client->stream));



        $meta = stream_get_meta_data($client->stream);

        $this->assertTrue(isset($meta['crypto']['protocol']));



        if ($meta['crypto']['protocol'] === 'UNKNOWN') {
<?php         $this->assertInstanceOf('React\Socket\Connection', $client);

        $this->assertTrue(isset($client->stream));



        $meta = stream_get_meta_data($client->stream);

        $this->assertTrue(isset($meta['crypto']['protocol']));

        $this->assertEquals('TLSv1.2', $meta['crypto']['protocol']);