Phly\Http\Stream::__construct PHP Method

__construct() public method

public __construct ( string | resource $stream, string $mode = 'r' )
$stream string | resource
$mode string Mode with which to open stream
    public function __construct($stream, $mode = 'r')
    {
        $this->stream = $stream;
        if (is_resource($stream)) {
            $this->resource = $stream;
        } elseif (is_string($stream)) {
            set_error_handler(function ($errno, $errstr) {
                throw new InvalidArgumentException('Invalid file provided for stream; must be a valid path with valid permissions');
            }, E_WARNING);
            $this->resource = fopen($stream, $mode);
            restore_error_handler();
        } else {
            throw new InvalidArgumentException('Invalid stream provided; must be a string stream identifier or resource');
        }
    }