public static function checkWhetherArchiveIsBomb(\ZipArchive $archive, $minCompressionRatioToBeBomb = 200)
    {
        if (!$archive->filename) {
            throw new common_Exception('ZIP archive should be opened before checking for a ZIP bomb');
        }

        $contentSize = 0;
        for ($fileIndex = 0; $fileIndex < $archive->numFiles; $fileIndex++) {
            $stats = $archive->statIndex($fileIndex);
            $contentSize += $stats['size'];
        }

        $archiveFileSize = filesize($archive->filename);

        return $archiveFileSize * $minCompressionRatioToBeBomb < $contentSize;
    }