You are here

function PclZip::merge in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZip::merge()

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php, line 1221

Class

PclZip

Code

function merge($p_archive_to_add) {
  $v_result = 1;

  // ----- Reset the error handler
  $this
    ->privErrorReset();

  // ----- Check archive
  if (!$this
    ->privCheckFormat()) {
    return 0;
  }

  // ----- Look if the $p_archive_to_add is a PclZip object
  if (is_object($p_archive_to_add) && get_class($p_archive_to_add) == 'pclzip') {

    // ----- Merge the archive
    $v_result = $this
      ->privMerge($p_archive_to_add);
  }
  else {
    if (is_string($p_archive_to_add)) {

      // ----- Create a temporary archive
      $v_object_archive = new PclZip($p_archive_to_add);

      // ----- Merge the archive
      $v_result = $this
        ->privMerge($v_object_archive);
    }
    else {

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
    }
  }

  // ----- Return
  return $v_result;
}