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

Splitter. More...

+ Inheritance diagram for Sabre\VObject\Splitter\ICalendar:
+ Collaboration diagram for Sabre\VObject\Splitter\ICalendar:

Public Member Functions

 __construct ($input, $options=0)
 Constructor. More...
 
 getNext ()
 Every time getNext() is called, a new object will be parsed, until we hit the end of the stream. More...
 
- Public Member Functions inherited from Sabre\VObject\Splitter\SplitterInterface
 __construct ($input)
 Constructor. More...
 
 getNext ()
 Every time getNext() is called, a new object will be parsed, until we hit the end of the stream. More...
 

Protected Attributes

 $vtimezones = []
 
 $objects = []
 

Detailed Description

Splitter.

This class is responsible for splitting up iCalendar objects.

This class expects a single VCALENDAR object with one or more calendar-objects inside. Objects with identical UID's will be combined into a single object.

Author
Dominik Tobschall (http://tobschall.de/)
Armin Hackmann @license http://sabre.io/license/ Modified BSD License

Definition at line 22 of file ICalendar.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\VObject\Splitter\ICalendar::__construct (   $input,
  $options = 0 
)

Constructor.

The splitter should receive an readable file stream as it's input.

Parameters
resource$input
int$optionsParser options, see the OPTIONS constants.

Definition at line 46 of file ICalendar.php.

46 {
47
49
50 if (!$data instanceof VObject\Component\VCalendar) {
51 throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.');
52 }
53
54 foreach ($data->children() as $component) {
55 if (!$component instanceof VObject\Component) {
56 continue;
57 }
58
59 // Get all timezones
60 if ($component->name === 'VTIMEZONE') {
61 $this->vtimezones[(string)$component->TZID] = $component;
62 continue;
63 }
64
65 // Get component UID for recurring Events search
66 if (!$component->UID) {
67 $component->UID = sha1(microtime()) . '-vobjectimport';
68 }
69 $uid = (string)$component->UID;
70
71 // Take care of recurring events
72 if (!array_key_exists($uid, $this->objects)) {
73 $this->objects[$uid] = new VCalendar();
74 }
75
76 $this->objects[$uid]->add(clone $component);
77 }
78
79 }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
foreach( $paths as $path) if(!class_exists( 'Sabre\\VObject\\Version'))
foreach($paths as $path) if($argc< 3) $input
$data
Definition: bench.php:6

References $data, Sabre\VObject\$input, PHPMailer\PHPMailer\$options, Sabre\VObject\if, and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getNext()

Sabre\VObject\Splitter\ICalendar::getNext ( )

Every time getNext() is called, a new object will be parsed, until we hit the end of the stream.

When the end is reached, null will be returned.

Returns
Sabre\VObject\Component|null

Implements Sabre\VObject\Splitter\SplitterInterface.

Definition at line 89 of file ICalendar.php.

89 {
90
91 if ($object = array_shift($this->objects)) {
92
93 // create our baseobject
94 $object->version = '2.0';
95 $object->prodid = '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN';
96 $object->calscale = 'GREGORIAN';
97
98 // add vtimezone information to obj (if we have it)
99 foreach ($this->vtimezones as $vtimezone) {
100 $object->add($vtimezone);
101 }
102
103 return $object;
104
105 } else {
106
107 return;
108
109 }
110
111 }
const VERSION
Full version number.
Definition: Version.php:17

References Sabre\VObject\Version\VERSION.

Field Documentation

◆ $objects

Sabre\VObject\Splitter\ICalendar::$objects = []
protected

Definition at line 36 of file ICalendar.php.

◆ $vtimezones

Sabre\VObject\Splitter\ICalendar::$vtimezones = []
protected

Definition at line 29 of file ICalendar.php.


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