本文整理汇总了PHP中Sabre\VObject\Property::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::setValue方法的具体用法?PHP Property::setValue怎么用?PHP Property::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\VObject\Property
的用法示例。
在下文中一共展示了Property::setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
/**
* 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: setValue
/**
* 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: setValue
/**
* 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: decodeProperty
/**
* 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]);
}
}
}