Archive_Tar::setAttribute PHP Method

setAttribute() public method

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, ',');
public setAttribute ( ) : true
return true on success, false on error.
    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;
    }