/** * Sets the value of an attribute. * * @param string $name The name of the attribute. * @param string $value The value of the attribute. * @param array $params Array containing any addition parameters for * this attribute. * @param boolean $append True to append the attribute, False to replace * the first matching attribute found. * @param array $values Array representation of $value. For * comma/semicolon seperated lists of values. If * not set use $value as single array element. */ public function setAttribute($name, $value, $params = array(), $append = true, $values = false) { // Make sure we update the internal format version if // setAttribute('VERSION', ...) is called. if ($name == 'VERSION') { $this->setVersion($value); if ($this->_container !== false) { $this->_container->setVersion($value); } } if (!$values) { $values = array($value); } $found = false; if (!$append) { foreach (array_keys($this->_attributes) as $key) { if ($this->_attributes[$key]['name'] == Horde_String::upper($name)) { $this->_attributes[$key]['params'] = $params; $this->_attributes[$key]['value'] = $value; $this->_attributes[$key]['values'] = $values; $found = true; break; } } } if ($append || !$found) { $this->_attributes[] = array('name' => Horde_String::upper($name), 'params' => $params, 'value' => $value, 'values' => $values); } }