本文整理匯總了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]);
}
}
}