ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Property Class Reference

Property. More...

+ Inheritance diagram for Sabre\VObject\Property:
+ Collaboration diagram for Sabre\VObject\Property:

Public Member Functions

 __construct (Component $root, $name, $value=null, array $parameters=[], $group=null)
 Creates the generic property. More...
 
 setValue ($value)
 Updates the current value. More...
 
 getValue ()
 Returns the current value. More...
 
 setParts (array $parts)
 Sets a multi-valued property. More...
 
 getParts ()
 Returns a multi-valued property. More...
 
 add ($name, $value=null)
 Adds a new parameter. More...
 
 parameters ()
 Returns an iterable list of children. More...
 
 getValueType ()
 Returns the type of value. More...
 
 setRawMimeDirValue ($val)
 Sets a raw value coming from a mimedir (iCalendar/vCard) file. More...
 
 getRawMimeDirValue ()
 Returns a raw mime-dir representation of the value. More...
 
 serialize ()
 Turns the object back into a serialized blob. More...
 
 getJsonValue ()
 Returns the value, in the format it should be encoded for JSON. More...
 
 setJsonValue (array $value)
 Sets the JSON value, as it would appear in a jCard or jCal object. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 setXmlValue (array $value)
 Hydrate data from a XML subtree, as it would appear in a xCard or xCal object. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 __toString ()
 Called when this object is being cast to a string. More...
 
 offsetExists ($name)
 Checks if an array element exists. More...
 
 offsetGet ($name)
 Returns a parameter. More...
 
 offsetSet ($name, $value)
 Creates a new parameter. More...
 
 offsetUnset ($name)
 Removes one or more parameters with the specified name. More...
 
 __clone ()
 This method is automatically called when the object is cloned. More...
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
- Public Member Functions inherited from Sabre\VObject\Node
 serialize ()
 Serializes the node into a mimedir format. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
 getIterator ()
 Returns the iterator for this object. More...
 
 setIterator (ElementList $iterator)
 Sets the overridden iterator. More...
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 count ()
 Returns the number of elements. More...
 
 offsetExists ($offset)
 Checks if an item exists through ArrayAccess. More...
 
 offsetGet ($offset)
 Gets an item through ArrayAccess. More...
 
 offsetSet ($offset, $value)
 Sets an item through ArrayAccess. More...
 
 offsetUnset ($offset)
 Sets an item through ArrayAccess. More...
 
- Public Member Functions inherited from Sabre\Xml\XmlSerializable
 xmlSerialize (Writer $writer)
 The xmlSerialize method is called during xml writing. More...
 

Data Fields

 $name
 
 $group
 
 $parameters = []
 
 $delimiter = ';'
 
- Data Fields inherited from Sabre\VObject\Node
const REPAIR = 1
 The following constants are used by the validate() method. More...
 
const PROFILE_CARDDAV = 2
 If this option is set, the validator will operate on the vcards on the assumption that the vcards need to be valid for CardDAV. More...
 
const PROFILE_CALDAV = 4
 If this option is set, the validator will operate on iCalendar objects on the assumption that the vcards need to be valid for CalDAV. More...
 
 $parent
 

Protected Member Functions

 xmlSerializeValue (Xml\Writer $writer)
 This method serializes only the value of a property. More...
 

Protected Attributes

 $value
 
- Protected Attributes inherited from Sabre\VObject\Node
 $iterator = null
 
 $root
 

Detailed Description

Property.

A property is always in a KEY:VALUE structure, and may optionally contain parameters.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 17 of file Property.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\VObject\Property::__construct ( Component  $root,
  $name,
  $value = null,
array  $parameters = [],
  $group = null 
)

Creates the generic property.

Parameters must be specified in key=>value syntax.

Parameters
Component$rootThe root document
string$name
string | array | null$value
array$parametersList of parameters
string$groupThe vcard property group
Returns
void

Reimplemented in Sabre\VObject\Property\Text.

Definition at line 72 of file Property.php.

72 {
73
74 $this->name = $name;
75 $this->group = $group;
76
77 $this->root = $root;
78
79 foreach ($parameters as $k => $v) {
80 $this->add($k, $v);
81 }
82
83 if (!is_null($value)) {
84 $this->setValue($value);
85 }
86
87 }
add($name, $value=null)
Adds a new parameter.
Definition: Property.php:174
setValue($value)
Updates the current value.
Definition: Property.php:98

References Sabre\VObject\Property\$group, Sabre\VObject\Property\$name, Sabre\VObject\Property\$parameters, Sabre\VObject\Node\$root, Sabre\VObject\Property\$value, Sabre\VObject\Property\add(), and Sabre\VObject\Property\setValue().

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

Sabre\VObject\Property::__clone ( )

This method is automatically called when the object is cloned.

Specifically, this will ensure all child elements are also cloned.

Returns
void

Definition at line 519 of file Property.php.

519 {
520
521 foreach ($this->parameters as $key => $child) {
522 $this->parameters[$key] = clone $child;
523 $this->parameters[$key]->parent = $this;
524 }
525
526 }
parameters()
Returns an iterable list of children.
Definition: Property.php:196
$key
Definition: croninfo.php:18

References $key, and Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ __toString()

Sabre\VObject\Property::__toString ( )

Called when this object is being cast to a string.

If the property only had a single value, you will get just that. In the case the property had multiple values, the contents will be escaped and combined with ,.

Returns
string

Definition at line 416 of file Property.php.

416 {
417
418 return (string)$this->getValue();
419
420 }
getValue()
Returns the current value.
Definition: Property.php:115

References Sabre\VObject\Property\getValue().

+ Here is the call graph for this function:

◆ add()

Sabre\VObject\Property::add (   $name,
  $value = null 
)

Adds a new parameter.

If a parameter with same name already existed, the values will be combined. If nameless parameter is added, we try to guess it's name.

Parameters
string$name
string | null | array$value

Definition at line 174 of file Property.php.

174 {
175 $noName = false;
176 if ($name === null) {
178 $noName = true;
179 }
180
181 if (isset($this->parameters[strtoupper($name)])) {
182 $this->parameters[strtoupper($name)]->addValue($value);
183 }
184 else {
185 $param = new Parameter($this->root, $name, $value);
186 $param->noName = $noName;
187 $this->parameters[$param->name] = $param;
188 }
189 }
static guessParameterNameByValue($value)
Try to guess property name by value, can be used for vCard 2.1 nameless parameters.
Definition: Parameter.php:85

References Sabre\VObject\Property\$name, Sabre\VObject\Property\$value, Sabre\VObject\Parameter\guessParameterNameByValue(), and Sabre\VObject\Property\parameters().

Referenced by Sabre\VObject\Property\__construct(), Sabre\VObject\VCardConverter\convertParameters30(), and Sabre\VObject\VCardConverter\convertParameters40().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

Sabre\VObject\Property::destroy ( )

Call this method on a document if you're done using it.

It's intended to remove all circular references, so PHP can easily clean it up.

Returns
void

Reimplemented from Sabre\VObject\Node.

Definition at line 651 of file Property.php.

651 {
652
653 parent::destroy();
654 foreach ($this->parameters as $param) {
655 $param->destroy();
656 }
657 $this->parameters = [];
658
659 }

References Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ getJsonValue()

Sabre\VObject\Property::getJsonValue ( )

Returns the value, in the format it should be encoded for JSON.

This method must always return an array.

Returns
array

Reimplemented in Sabre\VObject\Property\Binary, Sabre\VObject\Property\FloatValue, Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Period, Sabre\VObject\Property\ICalendar\Recur, Sabre\VObject\Property\IntegerValue, Sabre\VObject\Property\Text, Sabre\VObject\Property\Time, Sabre\VObject\Property\Unknown, Sabre\VObject\Property\UtcOffset, Sabre\VObject\Property\VCard\DateAndOrTime, and Sabre\VObject\Property\VCard\TimeStamp.

Definition at line 271 of file Property.php.

271 {
272
273 return $this->getParts();
274
275 }
getParts()
Returns a multi-valued property.
Definition: Property.php:152

References Sabre\VObject\Property\getParts().

Referenced by Sabre\VObject\Property\jsonSerialize(), and Sabre\VObject\Property\xmlSerializeValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParts()

Sabre\VObject\Property::getParts ( )

Returns a multi-valued property.

This method always returns an array, if there was only a single value, it will still be wrapped in an array.

Returns
array

Reimplemented in Sabre\VObject\Property\ICalendar\Recur.

Definition at line 152 of file Property.php.

152 {
153
154 if (is_null($this->value)) {
155 return [];
156 } elseif (is_array($this->value)) {
157 return $this->value;
158 } else {
159 return [$this->value];
160 }
161
162 }

References Sabre\VObject\Property\$value.

Referenced by Sabre\VObject\VCardConverter\convertProperty(), Sabre\VObject\Property\ICalendar\Duration\getDateInterval(), Sabre\VObject\Property\ICalendar\DateTime\getDateTimes(), Sabre\VObject\Property\getJsonValue(), Sabre\VObject\Property\FloatValue\getJsonValue(), Sabre\VObject\Property\ICalendar\Period\getJsonValue(), Sabre\VObject\Property\Text\getJsonValue(), Sabre\VObject\Property\FloatValue\getRawMimeDirValue(), Sabre\VObject\Property\ICalendar\DateTime\getRawMimeDirValue(), Sabre\VObject\Property\ICalendar\Duration\getRawMimeDirValue(), Sabre\VObject\Property\ICalendar\Period\getRawMimeDirValue(), Sabre\VObject\Property\Text\getRawMimeDirValue(), Sabre\VObject\Property\VCard\DateAndOrTime\getRawMimeDirValue(), Sabre\VObject\Property\Text\serialize(), Sabre\VObject\Cli\serializeProperty(), Sabre\VObject\Property\ICalendar\DateTime\validate(), Sabre\VObject\Property\Text\validate(), Sabre\VObject\Property\FloatValue\xmlSerializeValue(), and Sabre\VObject\Property\Text\xmlSerializeValue().

+ Here is the caller graph for this function:

◆ getRawMimeDirValue()

◆ getValue()

Sabre\VObject\Property::getValue ( )

Returns the current value.

This method will always return a singular value. If this was a multi-value object, some decision will be made first on how to represent it as a string.

To get the correct multi-value version, use getParts.

Returns
string

Reimplemented in Sabre\VObject\Property\ICalendar\Recur.

Definition at line 115 of file Property.php.

115 {
116
117 if (is_array($this->value)) {
118 if (count($this->value) == 0) {
119 return;
120 } elseif (count($this->value) === 1) {
121 return $this->value[0];
122 } else {
123 return $this->getRawMimeDirValue();
124 }
125 } else {
126 return $this->value;
127 }
128
129 }
count()
Returns the number of elements.
Definition: Node.php:177
getRawMimeDirValue()
Returns a raw mime-dir representation of the value.

References Sabre\VObject\Property\$value, Sabre\VObject\Node\count(), and Sabre\VObject\Property\getRawMimeDirValue().

Referenced by Sabre\VObject\Property\__toString(), Sabre\VObject\VCardConverter\convertProperty(), Sabre\VObject\Property\VCard\DateAndOrTime\getDateTime(), Sabre\VObject\Property\Binary\getJsonValue(), Sabre\VObject\Property\IntegerValue\getJsonValue(), Sabre\VObject\Property\Time\getJsonValue(), Sabre\VObject\Property\VCard\DateAndOrTime\getJsonValue(), Sabre\VObject\Property\VCard\TimeStamp\getJsonValue(), Sabre\VObject\Property\ICalendar\CalAddress\getNormalizedValue(), Sabre\VObject\Property\VCard\LanguageTag\getRawMimeDirValue(), Sabre\VObject\Property\ICalendar\DateTime\isFloating(), Sabre\VObject\Cli\serializeProperty(), Sabre\VObject\Property\VCard\DateAndOrTime\validate(), Sabre\VObject\Property\VCard\DateAndOrTime\xmlSerializeValue(), and Sabre\VObject\Property\VCard\TimeStamp\xmlSerializeValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValueType()

◆ jsonSerialize()

Sabre\VObject\Property::jsonSerialize ( )

This method returns an array, with the representation as it should be encoded in JSON.

This is used to create jCard or jCal documents.

Returns
array

Reimplemented from Sabre\VObject\Node.

Definition at line 302 of file Property.php.

302 {
303
304 $parameters = [];
305
306 foreach ($this->parameters as $parameter) {
307 if ($parameter->name === 'VALUE') {
308 continue;
309 }
310 $parameters[strtolower($parameter->name)] = $parameter->jsonSerialize();
311 }
312 // In jCard, we need to encode the property-group as a separate 'group'
313 // parameter.
314 if ($this->group) {
315 $parameters['group'] = $this->group;
316 }
317
318 return array_merge(
319 [
320 strtolower($this->name),
321 (object)$parameters,
322 strtolower($this->getValueType()),
323 ],
324 $this->getJsonValue()
325 );
326 }
getValueType()
Returns the type of value.
getJsonValue()
Returns the value, in the format it should be encoded for JSON.
Definition: Property.php:271

References Sabre\VObject\Property\$group, Sabre\VObject\Property\$parameters, Sabre\VObject\Property\getJsonValue(), Sabre\VObject\Property\getValueType(), and Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ offsetExists()

Sabre\VObject\Property::offsetExists (   $name)

Checks if an array element exists.

Parameters
mixed$name
Returns
bool

Reimplemented from Sabre\VObject\Node.

Definition at line 431 of file Property.php.

431 {
432
433 if (is_int($name)) return parent::offsetExists($name);
434
435 $name = strtoupper($name);
436
437 foreach ($this->parameters as $parameter) {
438 if ($parameter->name == $name) return true;
439 }
440 return false;
441
442 }

References Sabre\VObject\Property\$name, and Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ offsetGet()

Sabre\VObject\Property::offsetGet (   $name)

Returns a parameter.

If the parameter does not exist, null is returned.

Parameters
string$name
Returns
Node

Reimplemented from Sabre\VObject\Node.

Definition at line 453 of file Property.php.

453 {
454
455 if (is_int($name)) return parent::offsetGet($name);
456 $name = strtoupper($name);
457
458 if (!isset($this->parameters[$name])) {
459 return;
460 }
461
462 return $this->parameters[$name];
463
464 }

References Sabre\VObject\Property\$name, and Sabre\VObject\Property\parameters().

Referenced by Sabre\VObject\Property\validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetSet()

Sabre\VObject\Property::offsetSet (   $name,
  $value 
)

Creates a new parameter.

Parameters
string$name
mixed$value
Returns
void

Reimplemented from Sabre\VObject\Node.

Reimplemented in Sabre\VObject\Property\ICalendar\DateTime.

Definition at line 474 of file Property.php.

474 {
475
476 if (is_int($name)) {
477 parent::offsetSet($name, $value);
478 // @codeCoverageIgnoreStart
479 // This will never be reached, because an exception is always
480 // thrown.
481 return;
482 // @codeCoverageIgnoreEnd
483 }
484
485 $param = new Parameter($this->root, $name, $value);
486 $this->parameters[$param->name] = $param;
487
488 }
VObject Parameter.
Definition: Parameter.php:20

References Sabre\VObject\Property\$name, Sabre\VObject\Property\$value, and Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ offsetUnset()

Sabre\VObject\Property::offsetUnset (   $name)

Removes one or more parameters with the specified name.

Parameters
string$name
Returns
void

Reimplemented from Sabre\VObject\Node.

Definition at line 497 of file Property.php.

497 {
498
499 if (is_int($name)) {
500 parent::offsetUnset($name);
501 // @codeCoverageIgnoreStart
502 // This will never be reached, because an exception is always
503 // thrown.
504 return;
505 // @codeCoverageIgnoreEnd
506 }
507
508 unset($this->parameters[strtoupper($name)]);
509
510 }

References Sabre\VObject\Property\$name, and Sabre\VObject\Property\parameters().

Referenced by Sabre\VObject\Property\ICalendar\DateTime\setDateTimes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parameters()

◆ serialize()

Sabre\VObject\Property::serialize ( )

Turns the object back into a serialized blob.

Returns
string

Reimplemented from Sabre\VObject\Node.

Reimplemented in Sabre\VObject\Property\Text.

Definition at line 236 of file Property.php.

236 {
237
238 $str = $this->name;
239 if ($this->group) $str = $this->group . '.' . $this->name;
240
241 foreach ($this->parameters() as $param) {
242
243 $str .= ';' . $param->serialize();
244
245 }
246
247 $str .= ':' . $this->getRawMimeDirValue();
248
249 $str = \preg_replace(
250 '/(
251 (?:^.)? # 1 additional byte in first line because of missing single space (see next line)
252 .{1,74} # max 75 bytes per line (1 byte is used for a single space added after every CRLF)
253 (?![\x80-\xbf]) # prevent splitting multibyte characters
254 )/x',
255 "$1\r\n ",
256 $str
257 );
258
259 // remove single space after last CRLF
260 return \substr($str, 0, -1);
261
262 }

References Sabre\VObject\Property\$name, Sabre\VObject\Property\getRawMimeDirValue(), and Sabre\VObject\Property\parameters().

+ Here is the call graph for this function:

◆ setJsonValue()

Sabre\VObject\Property::setJsonValue ( array  $value)

Sets the JSON value, as it would appear in a jCard or jCal object.

The value must always be an array.

Parameters
array$value
Returns
void

Reimplemented in Sabre\VObject\Property\Binary, Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Period, Sabre\VObject\Property\Time, and Sabre\VObject\Property\UtcOffset.

Definition at line 286 of file Property.php.

286 {
287
288 if (count($value) === 1) {
289 $this->setValue(reset($value));
290 } else {
291 $this->setValue($value);
292 }
293
294 }

References Sabre\VObject\Property\$value, Sabre\VObject\Node\count(), and Sabre\VObject\Property\setValue().

Referenced by Sabre\VObject\Property\setXmlValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParts()

Sabre\VObject\Property::setParts ( array  $parts)

Sets a multi-valued property.

Parameters
array$parts
Returns
void

Reimplemented in Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Recur, and Sabre\VObject\Property\VCard\DateAndOrTime.

Definition at line 138 of file Property.php.

138 {
139
140 $this->value = $parts;
141
142 }

Referenced by Sabre\VObject\Property\FloatValue\setRawMimeDirValue(), and Sabre\VObject\Property\Text\validate().

+ Here is the caller graph for this function:

◆ setRawMimeDirValue()

Sabre\VObject\Property::setRawMimeDirValue (   $val)
abstract

Sets a raw value coming from a mimedir (iCalendar/vCard) file.

This has been 'unfolded', so only 1 line will be passed. Unescaping is not yet done, but parameters are not included.

Parameters
string$val
Returns
void

Reimplemented in Sabre\VObject\Property\Binary, Sabre\VObject\Property\Boolean, Sabre\VObject\Property\FloatValue, Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Duration, Sabre\VObject\Property\ICalendar\Period, Sabre\VObject\Property\ICalendar\Recur, Sabre\VObject\Property\IntegerValue, Sabre\VObject\Property\Text, Sabre\VObject\Property\Uri, Sabre\VObject\Property\VCard\DateAndOrTime, and Sabre\VObject\Property\VCard\LanguageTag.

Referenced by Sabre\VObject\Property\validate().

+ Here is the caller graph for this function:

◆ setValue()

◆ setXmlValue()

Sabre\VObject\Property::setXmlValue ( array  $value)

Hydrate data from a XML subtree, as it would appear in a xCard or xCal object.

Parameters
array$value
Returns
void

Reimplemented in Sabre\VObject\Property\Boolean, Sabre\VObject\Property\FloatValue, Sabre\VObject\Property\IntegerValue, and Sabre\VObject\Property\Time.

Definition at line 336 of file Property.php.

336 {
337
338 $this->setJsonValue($value);
339
340 }
setJsonValue(array $value)
Sets the JSON value, as it would appear in a jCard or jCal object.
Definition: Property.php:286

References Sabre\VObject\Property\setJsonValue().

+ Here is the call graph for this function:

◆ validate()

Sabre\VObject\Property::validate (   $options = 0)

Validates the node for correctness.

The following options are supported:

  • Node::REPAIR - If something is broken, and automatic repair may be attempted.

An array is returned with warnings.

Every item in the array has the following properties:

  • level - (number between 1 and 3 with severity information)
  • message - (human readable message)
  • node - (reference to the offending node)
Parameters
int$options
Returns
array

Reimplemented from Sabre\VObject\Node.

Reimplemented in Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Recur, Sabre\VObject\Property\Text, and Sabre\VObject\Property\VCard\DateAndOrTime.

Definition at line 546 of file Property.php.

546 {
547
548 $warnings = [];
549
550 // Checking if our value is UTF-8
551 if (!StringUtil::isUTF8($this->getRawMimeDirValue())) {
552
553 $oldValue = $this->getRawMimeDirValue();
554 $level = 3;
555 if ($options & self::REPAIR) {
556 $newValue = StringUtil::convertToUTF8($oldValue);
557 if (true || StringUtil::isUTF8($newValue)) {
558 $this->setRawMimeDirValue($newValue);
559 $level = 1;
560 }
561
562 }
563
564
565 if (preg_match('%([\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', $oldValue, $matches)) {
566 $message = 'Property contained a control character (0x' . bin2hex($matches[1]) . ')';
567 } else {
568 $message = 'Property is not valid UTF-8! ' . $oldValue;
569 }
570
571 $warnings[] = [
572 'level' => $level,
573 'message' => $message,
574 'node' => $this,
575 ];
576 }
577
578 // Checking if the propertyname does not contain any invalid bytes.
579 if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
580 $warnings[] = [
581 'level' => $options & self::REPAIR ? 1 : 3,
582 'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
583 'node' => $this,
584 ];
585 if ($options & self::REPAIR) {
586 // Uppercasing and converting underscores to dashes.
587 $this->name = strtoupper(
588 str_replace('_', '-', $this->name)
589 );
590 // Removing every other invalid character
591 $this->name = preg_replace('/([^A-Z0-9-])/u', '', $this->name);
592
593 }
594
595 }
596
597 if ($encoding = $this->offsetGet('ENCODING')) {
598
599 if ($this->root->getDocumentType() === Document::VCARD40) {
600 $warnings[] = [
601 'level' => 3,
602 'message' => 'ENCODING parameter is not valid in vCard 4.',
603 'node' => $this
604 ];
605 } else {
606
607 $encoding = (string)$encoding;
608
609 $allowedEncoding = [];
610
611 switch ($this->root->getDocumentType()) {
613 $allowedEncoding = ['8BIT', 'BASE64'];
614 break;
615 case Document::VCARD21 :
616 $allowedEncoding = ['QUOTED-PRINTABLE', 'BASE64', '8BIT'];
617 break;
618 case Document::VCARD30 :
619 $allowedEncoding = ['B'];
620 break;
621
622 }
623 if ($allowedEncoding && !in_array(strtoupper($encoding), $allowedEncoding)) {
624 $warnings[] = [
625 'level' => 3,
626 'message' => 'ENCODING=' . strtoupper($encoding) . ' is not valid for this document type.',
627 'node' => $this
628 ];
629 }
630 }
631
632 }
633
634 // Validating inner parameters
635 foreach ($this->parameters as $param) {
636 $warnings = array_merge($warnings, $param->validate($options));
637 }
638
639 return $warnings;
640
641 }
const VCARD30
vCard 3.0.
Definition: Document.php:44
const ICALENDAR20
iCalendar 2.0.
Definition: Document.php:34
const VCARD21
vCard 2.1.
Definition: Document.php:39
const VCARD40
vCard 4.0.
Definition: Document.php:49
offsetGet($name)
Returns a parameter.
Definition: Property.php:453
setRawMimeDirValue($val)
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
static convertToUTF8($str)
This method tries its best to convert the input string to UTF-8.
Definition: StringUtil.php:42
static isUTF8($str)
Returns true or false depending on if a string is valid UTF-8.
Definition: StringUtil.php:21
catch(Exception $e) $message

References $message, PHPMailer\PHPMailer\$options, $warnings, Sabre\VObject\StringUtil\convertToUTF8(), Sabre\VObject\Property\getRawMimeDirValue(), Sabre\VObject\Document\ICALENDAR20, Sabre\VObject\StringUtil\isUTF8(), Sabre\VObject\Property\offsetGet(), Sabre\VObject\Property\parameters(), Sabre\VObject\Property\setRawMimeDirValue(), Sabre\VObject\Document\VCARD21, Sabre\VObject\Document\VCARD30, and Sabre\VObject\Document\VCARD40.

+ Here is the call graph for this function:

◆ xmlSerialize()

Sabre\VObject\Property::xmlSerialize ( Xml\Writer  $writer)

This method serializes the data into XML.

This is used to create xCard or xCal documents.

Parameters
Xml\Writer$writerXML writer.
Returns
void

Reimplemented from Sabre\VObject\Node.

Definition at line 350 of file Property.php.

350 {
351
352 $parameters = [];
353
354 foreach ($this->parameters as $parameter) {
355
356 if ($parameter->name === 'VALUE') {
357 continue;
358 }
359
360 $parameters[] = $parameter;
361
362 }
363
364 $writer->startElement(strtolower($this->name));
365
366 if (!empty($parameters)) {
367
368 $writer->startElement('parameters');
369
370 foreach ($parameters as $parameter) {
371
372 $writer->startElement(strtolower($parameter->name));
373 $writer->write($parameter);
374 $writer->endElement();
375
376 }
377
378 $writer->endElement();
379
380 }
381
382 $this->xmlSerializeValue($writer);
383 $writer->endElement();
384
385 }
xmlSerializeValue(Xml\Writer $writer)
This method serializes only the value of a property.
Definition: Property.php:395

References Sabre\VObject\Property\$parameters, Sabre\VObject\Property\parameters(), and Sabre\VObject\Property\xmlSerializeValue().

+ Here is the call graph for this function:

◆ xmlSerializeValue()

Sabre\VObject\Property::xmlSerializeValue ( Xml\Writer  $writer)
protected

This method serializes only the value of a property.

This is used to create xCard or xCal documents.

Parameters
Xml\Writer$writerXML writer.
Returns
void

Reimplemented in Sabre\VObject\Property\FloatValue, Sabre\VObject\Property\Text, Sabre\VObject\Property\VCard\DateAndOrTime, and Sabre\VObject\Property\VCard\TimeStamp.

Definition at line 395 of file Property.php.

395 {
396
397 $valueType = strtolower($this->getValueType());
398
399 foreach ($this->getJsonValue() as $values) {
400 foreach ((array)$values as $value) {
401 $writer->writeElement($valueType, $value);
402 }
403 }
404
405 }
$values

References Sabre\VObject\Property\$value, $values, Sabre\VObject\Property\getJsonValue(), and Sabre\VObject\Property\getValueType().

Referenced by Sabre\VObject\Property\xmlSerialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $delimiter

Sabre\VObject\Property::$delimiter = ';'

Definition at line 57 of file Property.php.

◆ $group

Sabre\VObject\Property::$group

◆ $name

◆ $parameters

◆ $value

Sabre\VObject\Property::$value
protected

Definition at line 49 of file Property.php.

Referenced by Sabre\VObject\Property\__construct(), Sabre\VObject\Property\Text\__construct(), Sabre\VObject\Property\add(), Sabre\VObject\Property\ICalendar\Duration\getDateInterval(), Sabre\VObject\Property\UtcOffset\getJsonValue(), Sabre\VObject\Property\getParts(), Sabre\VObject\Property\ICalendar\Recur\getParts(), Sabre\VObject\Property\IntegerValue\getRawMimeDirValue(), Sabre\VObject\Property\Uri\getRawMimeDirValue(), Sabre\VObject\Property\getValue(), Sabre\VObject\Property\ICalendar\Recur\getValue(), Sabre\VObject\Property\offsetSet(), Sabre\VObject\Property\ICalendar\DateTime\offsetSet(), Sabre\VObject\Property\VCard\DateAndOrTime\setDateTime(), Sabre\VObject\Property\setJsonValue(), Sabre\VObject\Property\Binary\setJsonValue(), Sabre\VObject\Property\ICalendar\DateTime\setJsonValue(), Sabre\VObject\Property\ICalendar\Period\setJsonValue(), Sabre\VObject\Property\Time\setJsonValue(), Sabre\VObject\Property\UtcOffset\setJsonValue(), Sabre\VObject\Property\setValue(), Sabre\VObject\Property\Binary\setValue(), Sabre\VObject\Property\ICalendar\DateTime\setValue(), Sabre\VObject\Property\ICalendar\Recur\setValue(), Sabre\VObject\Property\VCard\DateAndOrTime\setValue(), Sabre\VObject\Property\Boolean\setXmlValue(), Sabre\VObject\Property\FloatValue\setXmlValue(), Sabre\VObject\Property\IntegerValue\setXmlValue(), Sabre\VObject\Property\Time\setXmlValue(), Sabre\VObject\Property\ICalendar\Recur\stringToArray(), Sabre\VObject\Property\ICalendar\DateTime\validate(), Sabre\VObject\Property\ICalendar\Recur\validate(), Sabre\VObject\Property\VCard\DateAndOrTime\validate(), Sabre\VObject\Property\xmlSerializeValue(), Sabre\VObject\Property\FloatValue\xmlSerializeValue(), Sabre\VObject\Property\ICalendar\Period\xmlSerializeValue(), Sabre\VObject\Property\ICalendar\Recur\xmlSerializeValue(), and Sabre\VObject\Property\VCard\DateAndOrTime\xmlSerializeValue().


The documentation for this class was generated from the following file: