source_path = $source_path; $this->default_alarms = $default_alarms; } /** * Calendars are not discovered, they live at the configured location. */ public function getHome($type) { if ($type == 'VEVENT' || $type == 'VTODO') { return $this->normalize_location($this->source_path); } return parent::getHome($type); } /** * List calendars at the configured location. */ public function listFolders($component = 'VEVENT') { $location = $this->getHome($component); // The location may be a calendar collection itself $info = $this->folderInfo($location); if (is_array($info) && in_array('calendar', (array) $info['resource_type']) && in_array($component, (array) $info['types']) ) { $folders = [$info]; } else { // ...or a collection of calendars $folders = parent::listFolders($component); } if (is_array($folders) && $this->default_alarms !== null) { foreach ($folders as $idx => $folder) { if (!isset($folder['alarms'])) { $folders[$idx]['alarms'] = $this->default_alarms; } } } return $folders; } }