public static function decompress(
        $compressedFile,
        $destinationFolder,
        $originalFilename = null,
        $format = 'gz',
        $allowedExtensions = [
            'csv',
            'tsv'
        ]
    ) {
        //TODO ADD tar.gz
        $supported_formats = [ 'gz', 'zip', 'tar'];
        if (!in_array($format, $supported_formats)) {
            throw new \Exception('Unsupported compression format');
        }
        switch ($format) {
            case 'gz':
                return self::decompressGz(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
            case 'zip':
                return self::decompressZip(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
            case 'tar':
                return self::decompressTar(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
        }
    }
public static function decompress(
        $compressedFile,
        $destinationFolder,
        $originalFilename = null,
        $format = 'gz',
        $allowedExtensions = [
            'csv',
            'tsv'
        ]
    ) {
        //TODO ADD tar.gz
        $supported_formats = [ 'gz', 'zip', 'tar'];
        if (!in_array($format, $supported_formats)) {
            throw new \Exception('Unsupported compression format');
        }
        switch ($format) {
            case 'gz':
                return self::decompressGz(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
            case 'zip':
                return self::decompressZip(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
            case 'tar':
                return self::decompressTar(
                    $compressedFile,
                    $destinationFolder,
                    $originalFilename,
                    $allowedExtensions
                );
        }
    }
public static function decompress ( $ compressedFile , $ destinationFolder , $ originalFilename = null , $ format = 'gz' , $ allowedExtensions = [ 'csv' , 'tsv' ] ) { //TODO ADD tar.gz $ supported_formats = [ 'gz' , 'zip' , 'tar' ] ; if ( ! in_array ( $ format , $ supported_formats ) ) { throw new \ Exception ( 'Unsupported compression format' ) ; } switch ( $ format ) { case 'gz' : return self :: decompressGz ( $ compressedFile , $ destinationFolder , $ originalFilename , $ allowedExtensions ) ; case 'zip' : return self :: decompressZip ( $ compressedFile , $ destinationFolder , $ originalFilename , $ allowedExtensions ) ; case 'tar' : return self :: decompressTar ( $ compressedFile , $ destinationFolder , $ originalFilename , $ allowedExtensions ) ; } }
decompress a file archive
@param string $compressedFile Archive path
@param string $destinationFolder Destination folder to decompress files
@param string $originalFilename Original file name
@param string $format Select format mode, Default is gz, gz, zip and tar are available.
@param string[] $allowedExtensions
@return array Returns a list with the decompressed files
@throws \Exception
decompress a file archive