ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Node.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\VObject;
4
5use Sabre\Xml;
6
14abstract class Node
15 implements \IteratorAggregate,
16 \ArrayAccess,
17 \Countable,
20
27 const REPAIR = 1;
28
36 const PROFILE_CARDDAV = 2;
37
45 const PROFILE_CALDAV = 4;
46
52 public $parent;
53
59 protected $iterator = null;
60
66 protected $root;
67
73 abstract function serialize();
74
81 abstract function jsonSerialize();
82
91 abstract function xmlSerialize(Xml\Writer $writer);
92
101 function destroy() {
102
103 $this->parent = null;
104 $this->root = null;
105
106 }
107
108 /* {{{ IteratorAggregator interface */
109
115 function getIterator() {
116
117 if (!is_null($this->iterator)) {
118 return $this->iterator;
119 }
120
121 return new ElementList([$this]);
122
123 }
124
135
136 $this->iterator = $iterator;
137
138 }
139
162 function validate($options = 0) {
163
164 return [];
165
166 }
167
168 /* }}} */
169
170 /* {{{ Countable interface */
171
177 function count() {
178
179 $it = $this->getIterator();
180 return $it->count();
181
182 }
183
184 /* }}} */
185
186 /* {{{ ArrayAccess Interface */
187
188
198 function offsetExists($offset) {
199
200 $iterator = $this->getIterator();
201 return $iterator->offsetExists($offset);
202
203 }
204
214 function offsetGet($offset) {
215
216 $iterator = $this->getIterator();
217 return $iterator->offsetGet($offset);
218
219 }
220
231 function offsetSet($offset, $value) {
232
233 $iterator = $this->getIterator();
234 $iterator->offsetSet($offset, $value);
235
236 // @codeCoverageIgnoreStart
237 //
238 // This method always throws an exception, so we ignore the closing
239 // brace
240 }
241 // @codeCoverageIgnoreEnd
242
252 function offsetUnset($offset) {
253
254 $iterator = $this->getIterator();
255 $iterator->offsetUnset($offset);
256
257 // @codeCoverageIgnoreStart
258 //
259 // This method always throws an exception, so we ignore the closing
260 // brace
261 }
262 // @codeCoverageIgnoreEnd
263
264 /* }}} */
265}
An exception for terminatinating execution or to throw for unit testing.
VObject ElementList.
Definition: ElementList.php:18
A node is the root class for every element in an iCalendar of vCard object.
Definition: Node.php:19
jsonSerialize()
This method returns an array, with the representation as it should be encoded in JSON.
const PROFILE_CARDDAV
If this option is set, the validator will operate on the vcards on the assumption that the vcards nee...
Definition: Node.php:36
getIterator()
Returns the iterator for this object.
Definition: Node.php:115
const PROFILE_CALDAV
If this option is set, the validator will operate on iCalendar objects on the assumption that the vca...
Definition: Node.php:45
count()
Returns the number of elements.
Definition: Node.php:177
setIterator(ElementList $iterator)
Sets the overridden iterator.
Definition: Node.php:134
offsetUnset($offset)
Sets an item through ArrayAccess.
Definition: Node.php:252
offsetSet($offset, $value)
Sets an item through ArrayAccess.
Definition: Node.php:231
serialize()
Serializes the node into a mimedir format.
destroy()
Call this method on a document if you're done using it.
Definition: Node.php:101
offsetExists($offset)
Checks if an item exists through ArrayAccess.
Definition: Node.php:198
xmlSerialize(Xml\Writer $writer)
This method serializes the data into XML.
const REPAIR
The following constants are used by the validate() method.
Definition: Node.php:27
offsetGet($offset)
Gets an item through ArrayAccess.
Definition: Node.php:214
validate($options=0)
Validates the node for correctness.
Definition: Node.php:162
iCalendar/vCard/jCal/jCard/xCal/xCard writer object.
Definition: Writer.php:17
Objects implementing XmlSerializable can control how they are represented in Xml.