ics-parser
ics-parser copied to clipboard
How to know that parsed url is valid iCAL?
Hi,
don't know where to ask, so I will try here.
I am using this line of code
$iCal = new ICal($message->getCalendarUrl());
and the result is always a valid object. Even if I send 'something' as calendarUrl
example of result
ICal\ICal {#3324
+alarmCount: 0
+eventCount: 0
+freeBusyCount: 0
+todoCount: 0
+defaultSpan: 2
+defaultTimeZone: "UTC"
+defaultWeekStart: "MO"
+skipRecurrence: false
+disableCharacterReplacement: false
+filterDaysBefore: null
+filterDaysAfter: null
+cal: []
#freeBusyIndex: 0
#lastKeyword: null
#validIanaTimeZones: []
#alteredRecurrenceInstances: []
#weekdays: array:7 [
"MO" => "monday"
"TU" => "tuesday"
"WE" => "wednesday"
"TH" => "thursday"
"FR" => "friday"
"SA" => "saturday"
"SU" => "sunday"
]
#frequencyConversion: array:4 [
"DAILY" => "day"
"WEEKLY" => "week"
"MONTHLY" => "month"
"YEARLY" => "year"
]
#httpBasicAuth: []
#httpUserAgent: null
#httpAcceptLanguage: null
-windowMinTimestamp: -2147483648
-windowMaxTimestamp: 9223372036854775807
-shouldFilterByWindow: false
}
How I can know that parsed URL, or text is a valid calendar file?
thank you
Great question - there currently isn't a mechanism for this functionality.
What would you expect? A new property called isValid which returns true or false?
Great question - there currently isn't a mechanism for this functionality.
What would you expect? A new property called
isValidwhich returnstrueorfalse?
I just bumped into this problem today as well :) I was wondering why it was working with garbage input, I just assumed it would return NULL if no calendar was found.
Please feel free to reopen if/when you'd like to submit a PR.