public function __construct(int $type, int $hwm = 0)
{
// @codeCoverageIgnoreStart
if (!extension_loaded('zlib')) {
throw new UnsupportedError('zlib extension required to decode compressed streams.');
}
// @codeCoverageIgnoreEnd
parent::__construct($hwm);
switch ($type) {
case self::GZIP:
case self::DEFLATE:
$this->resource = inflate_init($type);
break;
default:
throw new InvalidArgumentError('Invalid compression type.');
}
if (null === $this->resource) {
throw new FailureException('Could not initialize inflate handle.');
}
}