本文整理汇总了PHP中Sabre\VObject\Property::xmlSerializeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::xmlSerializeValue方法的具体用法?PHP Property::xmlSerializeValue怎么用?PHP Property::xmlSerializeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\VObject\Property
的用法示例。
在下文中一共展示了Property::xmlSerializeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmlSerializeValue
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
*
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer)
{
// Special-casing the GEO property.
//
// See:
// http://tools.ietf.org/html/rfc6321#section-3.4.1.2
if ($this->name === 'GEO') {
$value = array_map('floatval', $this->getParts());
$writer->writeElement('latitude', $value[0]);
$writer->writeElement('longitude', $value[1]);
} else {
parent::xmlSerializeValue($writer);
}
}
示例2: xmlSerializeValue
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
*
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer)
{
$values = $this->getParts();
$map = function ($items) use($values, $writer) {
foreach ($items as $i => $item) {
$writer->writeElement($item, !empty($values[$i]) ? $values[$i] : null);
}
};
switch ($this->name) {
// Special-casing the REQUEST-STATUS property.
//
// See:
// http://tools.ietf.org/html/rfc6321#section-3.4.1.3
case 'REQUEST-STATUS':
$writer->writeElement('code', $values[0]);
$writer->writeElement('description', $values[1]);
if (isset($values[2])) {
$writer->writeElement('data', $values[2]);
}
break;
case 'N':
$map(['surname', 'given', 'additional', 'prefix', 'suffix']);
break;
case 'GENDER':
$map(['sex', 'text']);
break;
case 'ADR':
$map(['pobox', 'ext', 'street', 'locality', 'region', 'code', 'country']);
break;
case 'CLIENTPIDMAP':
$map(['sourceid', 'uri']);
break;
default:
parent::xmlSerializeValue($writer);
}
}