function Archive_Tar::setAttribute

7.x system.tar.inc Archive_Tar::setAttribute()

This method set specific attributes of the archive. It uses a variable list of parameters, in the format attribute code + attribute values : $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');

@access public

Parameters

mixed $argv variable list of attributes and values:

Return value

true on success, false on error.

File

drupal/modules/system/system.tar.inc, line 585

Class

Archive_Tar
Creates a (compressed) Tar archive *

Code

function setAttribute() {
  $v_result = true;

  // ----- Get the number of variable list of arguments
  if (($v_size = func_num_args()) == 0) {
    return true;
  }

  // ----- Get the arguments
  $v_att_list = &func_get_args();

  // ----- Read the attributes
  $i = 0;
  while ($i < $v_size) {

    // ----- Look for next option
    switch ($v_att_list[$i]) {
      // ----- Look for options that request a string value
      case ARCHIVE_TAR_ATT_SEPARATOR:
        // ----- Check the number of parameters
        if (($i + 1) >= $v_size) {
          $this->_error('Invalid number of parameters for ' . 'attribute ARCHIVE_TAR_ATT_SEPARATOR');
          return false;
        }

        // ----- Get the value
        $this->_separator = $v_att_list[$i + 1];
        $i++;
        break;

      default :
        $this->_error('Unknow attribute code ' . $v_att_list[$i] . '');
        return false;
    }

    // ----- Next attribute
    $i++;
  }

  return $v_result;
}