Code Duplication    Length = 28-30 lines in 4 locations

app/Vendor/PHPExcel/PHPExcel/Shared/PCLZip/pclzip.lib.php 4 locations

@@ 3690-3717 (lines=28) @@
3687
    }
3688
3689
    // ----- Look for pre-extract callback
3690
    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
3691
3692
      // ----- Generate a local information
3693
      $v_local_header = array();
3694
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
3695
3696
      // ----- Call the callback
3697
      // Here I do not use call_user_func() because I need to send a reference to the
3698
      // header.
3699
//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
3700
      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
3701
      if ($v_result == 0) {
3702
        // ----- Change the file status
3703
        $p_entry['status'] = "skipped";
3704
        $v_result = 1;
3705
      }
3706
      
3707
      // ----- Look for abort result
3708
      if ($v_result == 2) {
3709
        // ----- This status is internal and will be changed in 'skipped'
3710
        $p_entry['status'] = "aborted";
3711
      	$v_result = PCLZIP_ERR_USER_ABORTED;
3712
      }
3713
3714
      // ----- Update the informations
3715
      // Only some fields can be modified
3716
      $p_entry['filename'] = $v_local_header['filename'];
3717
    }
3718
3719
3720
    // ----- Look if extraction should be done
@@ 4058-4085 (lines=28) @@
4055
    }
4056
4057
    // ----- Look for pre-extract callback
4058
    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4059
4060
      // ----- Generate a local information
4061
      $v_local_header = array();
4062
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4063
4064
      // ----- Call the callback
4065
      // Here I do not use call_user_func() because I need to send a reference to the
4066
      // header.
4067
//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
4068
      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4069
      if ($v_result == 0) {
4070
        // ----- Change the file status
4071
        $p_entry['status'] = "skipped";
4072
        $v_result = 1;
4073
      }
4074
4075
      // ----- Look for abort result
4076
      if ($v_result == 2) {
4077
        // ----- This status is internal and will be changed in 'skipped'
4078
        $p_entry['status'] = "aborted";
4079
      	$v_result = PCLZIP_ERR_USER_ABORTED;
4080
      }
4081
4082
      // ----- Update the informations
4083
      // Only some fields can be modified
4084
      $p_entry['filename'] = $v_local_header['filename'];
4085
    }
4086
4087
    // ----- Trace
4088
@@ 4173-4200 (lines=28) @@
4170
    }
4171
4172
    // ----- Look for pre-extract callback
4173
    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
4174
4175
      // ----- Generate a local information
4176
      $v_local_header = array();
4177
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4178
4179
      // ----- Call the callback
4180
      // Here I do not use call_user_func() because I need to send a reference to the
4181
      // header.
4182
//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
4183
      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
4184
      if ($v_result == 0) {
4185
        // ----- Change the file status
4186
        $p_entry['status'] = "skipped";
4187
        $v_result = 1;
4188
      }
4189
      
4190
      // ----- Look for abort result
4191
      if ($v_result == 2) {
4192
        // ----- This status is internal and will be changed in 'skipped'
4193
        $p_entry['status'] = "aborted";
4194
      	$v_result = PCLZIP_ERR_USER_ABORTED;
4195
      }
4196
4197
      // ----- Update the informations
4198
      // Only some fields can be modified
4199
      $p_entry['filename'] = $v_local_header['filename'];
4200
    }
4201
4202
4203
    // ----- Look if extraction should be done
@@ 4235-4264 (lines=30) @@
4232
    }
4233
4234
  	// ----- Change abort status
4235
  	if ($p_entry['status'] == "aborted") {
4236
        $p_entry['status'] = "skipped";
4237
  	}
4238
	
4239
    // ----- Look for post-extract callback
4240
    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
4241
4242
      // ----- Generate a local information
4243
      $v_local_header = array();
4244
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
4245
      
4246
      // ----- Swap the content to header
4247
      $v_local_header['content'] = $p_string;
4248
      $p_string = '';
4249
4250
      // ----- Call the callback
4251
      // Here I do not use call_user_func() because I need to send a reference to the
4252
      // header.
4253
//      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
4254
      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
4255
4256
      // ----- Swap back the content to header
4257
      $p_string = $v_local_header['content'];
4258
      unset($v_local_header['content']);
4259
4260
      // ----- Look for abort result
4261
      if ($v_result == 2) {
4262
      	$v_result = PCLZIP_ERR_USER_ABORTED;
4263
      }
4264
    }
4265
4266
    // ----- Return
4267
    return $v_result;