/** * Constructor * * The splitter should receive an readable file stream as it's input. * * @param string|resource|array $input * @param int $options Parser options, see the OPTIONS constants. */ public function __construct($input, $options = 0) { $data = Reader::readJSON($input, $options); $vtimezones = array(); $components = array(); foreach ($data->children() as $component) { if (!$component instanceof Component) { continue; } // Get all timezones if ($component->name === 'VTIMEZONE') { $this->vtimezones[(string) $component->TZID] = $component; continue; } // Get component UID for recurring Events search if (!$component->UID) { $component->UID = sha1(microtime()) . '-vobjectimport'; } $uid = (string) $component->UID; // Take care of recurring events if (!array_key_exists($uid, $this->objects)) { $this->objects[$uid] = new VCalendar(); } $this->objects[$uid]->add(clone $component); } }