Code Duplication    Length = 6-10 lines in 6 locations

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

@@ 2129-2134 (lines=6) @@
2126
2127
        // ----- Copy the block of file headers from the old archive
2128
        $v_size = $v_central_dir['size'];
2129
        while ($v_size != 0) {
2130
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2131
            $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
2132
            @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2133
            $v_size -= $v_read_size;
2134
        }
2135
2136
        // ----- Create the Central Dir files header
2137
        for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); ++$i) {
@@ 2722-2728 (lines=7) @@
2719
        // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2720
        fseek($v_file_compressed, 10);
2721
        $v_size = $p_header['compressed_size'];
2722
        while ($v_size != 0) {
2723
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
2724
            $v_buffer = @fread($v_file_compressed, $v_read_size);
2725
            @fwrite($this->zip_fd, $v_buffer, $v_read_size);
2726
            $v_size -= $v_read_size;
2727
        }
2728
2729
        // ----- Close the file
2730
        @fclose($v_file_compressed);
2731
@@ 3526-3535 (lines=10) @@
3523
3524
                    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3525
                    $v_size = $p_entry['compressed_size'];
3526
                    while ($v_size != 0) {
3527
                        $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3528
                        $v_buffer = @fread($this->zip_fd, $v_read_size);
3529
                        /* Try to speed up the code
3530
                        $v_binary_data = pack('a'.$v_read_size, $v_buffer);
3531
                        @fwrite($v_dest_file, $v_binary_data, $v_read_size);
3532
                        */
3533
                        @fwrite($v_dest_file, $v_buffer, $v_read_size);
3534
                        $v_size -= $v_read_size;
3535
                    }
3536
3537
                    // ----- Closing the destination file
3538
                    fclose($v_dest_file);
@@ 3652-3658 (lines=7) @@
3649
3650
        // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
3651
        $v_size = $p_entry['compressed_size'];
3652
        while ($v_size != 0) {
3653
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
3654
            $v_buffer = @fread($this->zip_fd, $v_read_size);
3655
            //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
3656
            @fwrite($v_dest_file, $v_buffer, $v_read_size);
3657
            $v_size -= $v_read_size;
3658
        }
3659
3660
        // ----- Write gz file format footer
3661
        $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
@@ 4711-4716 (lines=6) @@
4708
4709
        // ----- Copy the block of file headers from the old archive
4710
        $v_size = $v_central_dir['size'];
4711
        while ($v_size != 0) {
4712
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
4713
            $v_buffer = @fread($this->zip_fd, $v_read_size);
4714
            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
4715
            $v_size -= $v_read_size;
4716
        }
4717
4718
        // ----- Copy the block of file headers from the archive_to_add
4719
        $v_size = $v_central_dir_to_add['size'];
@@ 4720-4725 (lines=6) @@
4717
4718
        // ----- Copy the block of file headers from the archive_to_add
4719
        $v_size = $v_central_dir_to_add['size'];
4720
        while ($v_size != 0) {
4721
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
4722
            $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
4723
            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
4724
            $v_size -= $v_read_size;
4725
        }
4726
4727
        // ----- Merge the file comments
4728
        $v_comment = $v_central_dir['comment'] . ' ' . $v_central_dir_to_add['comment'];