Stream::__construct( resource $body )

In this article

Parameters

$bodyresourcerequired

Source

public function __construct($body)
{
    if (!\is_resource($body)) {
        throw new \InvalidArgumentException('First argument to Stream::__construct() must be resource');
    }
    $this->stream = $body;
    $meta = \stream_get_meta_data($this->stream);
    $this->seekable = $meta['seekable'] && 0 === \fseek($this->stream, 0, \SEEK_CUR);
    $this->readable = isset(self::READ_WRITE_HASH['read'][$meta['mode']]);
    $this->writable = isset(self::READ_WRITE_HASH['write'][$meta['mode']]);
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.