thrownew\InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
$this->offsetUnset($name);
$parameter=newParameter($name,$value);
$parameter->parent=$this;
$this->parameters[]=$parameter;
}elseif($valueinstanceofParameter){
if(!is_null($name))
thrownew\InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a \\Sabre\\VObject\\Parameter. Add using $array[]=$parameterObject.');
$value->parent=$this;
$this->parameters[]=$value;
}else{
thrownew\InvalidArgumentException('You can only add parameters to the property object');
}
}
/**
* Removes one or more parameters with the specified name
*
* @param string $name
* @return void
*/
publicfunctionoffsetUnset($name){
if(is_int($name))parent::offsetUnset($name);
$name=strtoupper($name);
foreach($this->parametersas$key=>$parameter){
if($parameter->name==$name){
$parameter->parent=null;
unset($this->parameters[$key]);
}
}
}
/* }}} */
/**
* Called when this object is being cast to a string
*
* @return string
*/
publicfunction__toString(){
return(string)$this->value;
}
/**
* This method is automatically called when the object is cloned.
* Specifically, this will ensure all child elements are also cloned.
*
* @return void
*/
publicfunction__clone(){
foreach($this->parametersas$key=>$child){
$this->parameters[$key]=clone$child;
$this->parameters[$key]->parent=$this;
}
}
/**
* Validates the node for correctness.
*
* The following options are supported:
* - Node::REPAIR - If something is broken, and automatic repair may
* be attempted.
*
* An array is returned with warnings.
*
* Every item in the array has the following properties:
* * level - (number between 1 and 3 with severity information)