/**
  * Updates the current value.
  *
  * This may be either a single, or multiple strings in an array.
  *
  * Instead of strings, you may also use DateTime here.
  *
  * @param string|array|\DateTime $value
  * @return void
  */
 public function setValue($value)
 {
     if ($value instanceof \DateTime) {
         $this->setDateTime($value);
     } else {
         parent::setValue($value);
     }
 }
示例#2
0
 /**
  * Updates the current value.
  *
  * This may be either a single, or multiple strings in an array.
  *
  * Instead of strings, you may also use DateTime here.
  *
  * @param string|array|DateTimeInterface $value
  *
  * @return void
  */
 function setValue($value)
 {
     if (is_array($value) && isset($value[0]) && $value[0] instanceof DateTimeInterface) {
         $this->setDateTimes($value);
     } elseif ($value instanceof DateTimeInterface) {
         $this->setDateTimes([$value]);
     } else {
         parent::setValue($value);
     }
 }
示例#3
0
 /**
  * Updates the current value.
  *
  * This may be either a single, or multiple strings in an array.
  *
  * Instead of strings, you may also use DateTime here.
  *
  * @param string|array|\DateTime $value
  * @return void
  */
 public function setValue($value)
 {
     if (is_array($value) && isset($value[0]) && $value[0] instanceof \DateTime) {
         $this->setDateTimes($value);
     } elseif ($value instanceof \DateTime) {
         $this->setDateTimes(array($value));
     } else {
         parent::setValue($value);
     }
 }
示例#4
0
 /**
  * Decode properties for upgrading from v. 2.1
  *
  * @param \Sabre\VObject\Property $property Reference to a \Sabre\VObject\Property.
  * The only encoding allowed in version 3.0 is 'b' for binary. All encoded strings
  * must therefore be decoded and the parameters removed.
  */
 protected function decodeProperty(&$property)
 {
     foreach ($property->parameters as $key => &$parameter) {
         // Check for values without names which Sabre interprets
         // as names without values.
         if (trim($parameter->getValue()) === '') {
             $parameter->setValue($parameter->name);
             $parameter->name = $this->paramName($parameter->name);
         }
         // Check out for encoded string and decode them :-[
         if (strtoupper($parameter->name) == 'ENCODING') {
             if (strtoupper($parameter->getValue()) == 'QUOTED-PRINTABLE') {
                 $property->setValue(str_replace("\r\n", "\n", VObject\StringUtil::convertToUTF8(quoted_printable_decode($property->getValue()))));
                 unset($property->parameters[$key]);
             } elseif (strtoupper($parameter->getValue()) == 'BASE64') {
                 $parameter->setValue('b');
             }
         } elseif (strtoupper($parameter->name) == 'CHARSET') {
             unset($property->parameters[$key]);
         }
     }
 }