public function Archive_Tar::setAttribute

public 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, ',');

Return value

true on success, false on error.

File

modules/system/system.tar.inc, line 707

Class

Archive_Tar

Code

public 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('Unknown attribute code ' . $v_att_list[$i] . '');
        return false;
    }

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

  return $v_result;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.tar.inc/function/Archive_Tar::setAttribute/7.x