diff --git a/src/Compression/Algorithms/LZ4.php b/src/Compression/Algorithms/LZ4.php index 60e5eb6..f3dbef7 100644 --- a/src/Compression/Algorithms/LZ4.php +++ b/src/Compression/Algorithms/LZ4.php @@ -16,6 +16,7 @@ class LZ4 extends Compression public function __construct(int $level = 0) { + parent::__construct(); $this->level = $level; } diff --git a/src/Compression/Algorithms/Zstd.php b/src/Compression/Algorithms/Zstd.php index 1c869e4..6d7cf63 100644 --- a/src/Compression/Algorithms/Zstd.php +++ b/src/Compression/Algorithms/Zstd.php @@ -16,6 +16,7 @@ class Zstd extends Compression public function __construct(int $level = 3) { + parent::__construct(); $this->level = $level; } diff --git a/src/Compression/Compression.php b/src/Compression/Compression.php index cf701cd..f84ffb6 100644 --- a/src/Compression/Compression.php +++ b/src/Compression/Compression.php @@ -20,6 +20,13 @@ abstract class Compression public const ZSTD = 'zstd'; + public function __construct() + { + if (!self::isSupported()) { + throw new \Exception('Compression algorithm' . $this->getName() . ' is not supported, missing extension'); + } + } + /** * Return the name of compression algorithm. *