useCompression === false) { return false; } $level = ($this->compressionLevel < 10 && $this->compressionLevel > 0) ? $this->compressionLevel : 4; $c = match ($this->method) { Method::DEFLATE => gzdeflate($data, $level), Method::GZIP => gzencode($data, $level), Method::ZLIB => gzcompress($data, $level), }; return base64_encode($c); } public function decompress(string $compressed_data): string|false { if ($this->useCompression === false) { return false; } $d = base64_decode($compressed_data); return match ($this->method) { Method::DEFLATE => gzinflate($d), Method::GZIP => gzdecode($d), Method::ZLIB => gzuncompress($d), }; } }