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

Time property. More...

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

Public Member Functions

 getValueType ()
 Returns the type of value. More...
 
 setJsonValue (array $value)
 Sets the JSON value, as it would appear in a jCard or jCal object. More...
 
 getJsonValue ()
 Returns the value, in the format it should be encoded for json. More...
 
 setXmlValue (array $value)
 Hydrate data from a XML subtree, as it would appear in a xCard or xCal object. More...
 
- Public Member Functions inherited from Sabre\VObject\Property\Text
 __construct (Component $root, $name, $value=null, array $parameters=[], $group=null)
 Creates the property. More...
 
 setRawMimeDirValue ($val)
 Sets a raw value coming from a mimedir (iCalendar/vCard) file. More...
 
 setQuotedPrintableValue ($val)
 Sets the value as a quoted-printable encoded string. More...
 
 getRawMimeDirValue ()
 Returns a raw mime-dir representation of the value. More...
 
 getJsonValue ()
 Returns the value, in the format it should be encoded for json. More...
 
 getValueType ()
 Returns the type of value. More...
 
 serialize ()
 Turns the object back into a serialized blob. More...
 
 validate ($options=0)
 Validates the node for correctness. More...
 
- Public Member Functions inherited from Sabre\VObject\Property
 __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

 $delimiter = null
 
- Data Fields inherited from Sabre\VObject\Property\Text
 $delimiter = ','
 
- Data Fields inherited from Sabre\VObject\Property
 $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
 

Additional Inherited Members

- Protected Member Functions inherited from Sabre\VObject\Property\Text
 xmlSerializeValue (Xml\Writer $writer)
 This method serializes only the value of a property. More...
 
- Protected Member Functions inherited from Sabre\VObject\Property
 xmlSerializeValue (Xml\Writer $writer)
 This method serializes only the value of a property. More...
 
- Protected Attributes inherited from Sabre\VObject\Property\Text
 $structuredValues
 
 $minimumPropertyValues
 
- Protected Attributes inherited from Sabre\VObject\Property
 $value
 
- Protected Attributes inherited from Sabre\VObject\Node
 $iterator = null
 
 $root
 

Detailed Description

Time property.

This object encodes TIME values.

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

Definition at line 16 of file Time.php.

Member Function Documentation

◆ getJsonValue()

Sabre\VObject\Property\Time::getJsonValue ( )

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

This method must always return an array.

Returns
array

Definition at line 73 of file Time.php.

References Sabre\VObject\Property\getValue(), and Sabre\VObject\DateTimeParser\parseVCardTime().

73  {
74 
75  $parts = DateTimeParser::parseVCardTime($this->getValue());
76  $timeStr = '';
77 
78  // Hour
79  if (!is_null($parts['hour'])) {
80  $timeStr .= $parts['hour'];
81 
82  if (!is_null($parts['minute'])) {
83  $timeStr .= ':';
84  }
85  } else {
86  // We know either minute or second _must_ be set, so we insert a
87  // dash for an empty value.
88  $timeStr .= '-';
89  }
90 
91  // Minute
92  if (!is_null($parts['minute'])) {
93  $timeStr .= $parts['minute'];
94 
95  if (!is_null($parts['second'])) {
96  $timeStr .= ':';
97  }
98  } else {
99  if (isset($parts['second'])) {
100  // Dash for empty minute
101  $timeStr .= '-';
102  }
103  }
104 
105  // Second
106  if (!is_null($parts['second'])) {
107  $timeStr .= $parts['second'];
108  }
109 
110  // Timezone
111  if (!is_null($parts['timezone'])) {
112  if ($parts['timezone'] === 'Z') {
113  $timeStr .= 'Z';
114  } else {
115  $timeStr .=
116  preg_replace('/([0-9]{2})([0-9]{2})$/', '$1:$2', $parts['timezone']);
117  }
118  }
119 
120  return [$timeStr];
121 
122  }
static parseVCardTime($date)
This method parses a vCard TIME value.
getValue()
Returns the current value.
Definition: Property.php:115
+ Here is the call graph for this function:

◆ getValueType()

Sabre\VObject\Property\Time::getValueType ( )

Returns the type of value.

This corresponds to the VALUE= parameter. Every property also has a 'default' valueType.

Returns
string

Definition at line 34 of file Time.php.

34  {
35 
36  return 'TIME';
37 
38  }

◆ setJsonValue()

Sabre\VObject\Property\Time::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

Definition at line 49 of file Time.php.

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

49  {
50 
51  // Removing colons from value.
52  $value = str_replace(
53  ':',
54  '',
55  $value
56  );
57 
58  if (count($value) === 1) {
59  $this->setValue(reset($value));
60  } else {
61  $this->setValue($value);
62  }
63 
64  }
setValue($value)
Updates the current value.
Definition: Property.php:98
count()
Returns the number of elements.
Definition: Node.php:177
+ Here is the call graph for this function:

◆ setXmlValue()

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

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

Parameters
array$value
Returns
void

Definition at line 132 of file Time.php.

References Sabre\VObject\Property\$value.

132  {
133 
134  $value = array_map(
135  function($value) {
136  return str_replace(':', '', $value);
137  },
138  $value
139  );
140  parent::setXmlValue($value);
141 
142  }

Field Documentation

◆ $delimiter

Sabre\VObject\Property\Time::$delimiter = null

Definition at line 24 of file Time.php.


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