コード例 #1
0
ファイル: Property.php プロジェクト: rolwi/koala
 /**
  * Creates a new parameter 
  * 
  * @param string $name
  * @param mixed $value
  * @return void
  */
 public function offsetSet($name, $value)
 {
     if (is_int($name)) {
         return parent::offsetSet($name, $value);
     }
     if (is_scalar($value)) {
         if (!is_string($name)) {
             throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
         }
         $this->parameters[] = new Sabre_VObject_Parameter($name, $value);
     } elseif ($value instanceof Sabre_VObject_Parameter) {
         if (!is_null($name)) {
             throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.');
         }
         $this->parameters[] = $value;
     } else {
         throw new InvalidArgumentException('You can only add parameters to the property object');
     }
 }