Code Duplication    Length = 5-8 lines in 5 locations

src/PhpSpreadsheet/Shared/PCLZip/PclZip.php 5 locations

@@ 2514-2518 (lines=5) @@
2511
                } else {
2512
                    // ----- Use "in memory" zip algo
2513
                    // ----- Open the source file
2514
                    if (($v_file = @fopen($p_filename, 'rb')) == 0) {
2515
                        self::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2516
2517
                        return self::errorCode();
2518
                    }
2519
2520
                    // ----- Read the file content
2521
                    $v_content = @fread($v_file, $p_header['size']);
@@ 2643-2647 (lines=5) @@
2640
        $p_filename = $p_filedescr['filename'];
2641
2642
        // ----- Open the source file
2643
        if (($v_file = @fopen($p_filename, 'rb')) == 0) {
2644
            self::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2645
2646
            return self::errorCode();
2647
        }
2648
2649
        // ----- Creates a compressed temporary file
2650
        $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz';
@@ 2680-2684 (lines=5) @@
2677
        }
2678
2679
        // ----- Extract the compressed attributes
2680
        if (($v_file_compressed = @fopen($v_gzip_temp_name, 'rb')) == 0) {
2681
            self::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode');
2682
2683
            return self::errorCode();
2684
        }
2685
2686
        // ----- Read the gzip file header
2687
        $v_binary_data = @fread($v_file_compressed, 10);
@@ 2713-2717 (lines=5) @@
2710
        }
2711
2712
        // ----- Add the compressed data
2713
        if (($v_file_compressed = @fopen($v_gzip_temp_name, 'rb')) == 0) {
2714
            self::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode');
2715
2716
            return self::errorCode();
2717
        }
2718
2719
        // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2720
        fseek($v_file_compressed, 10);
@@ 4806-4813 (lines=8) @@
4803
        }
4804
4805
        // ----- Open the temporary file in write mode
4806
        if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) {
4807
            $this->privCloseFd();
4808
4809
            self::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' . $p_archive_filename . '\' in binary write mode');
4810
4811
            // ----- Return
4812
            return self::errorCode();
4813
        }
4814
4815
        // ----- Copy the files from the archive to the temporary file
4816
        // TBC : Here I should better append the file and go back to erase the central dir