u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
439 stars 144 forks source link

Save the fact that content is an ical content #336

Closed axi closed 2 months ago

axi commented 2 months ago

The parser does already the job, so we can use it to "validate" it's really an ical content.

axi commented 2 months ago

Hey @u01jmg3, could you check this PR ? Thanks

axi commented 2 months ago

just thinking about this, I'm using the parser in a loop and before passing it a new url to parse, I have to

                // Reset from potential previous iteration
                $ical->cal = [];
                $ical->isIcalContent = false;

Should'nt that be in a new reset() method ? I can update the PR (or create a new one probably)

u01jmg3 commented 2 months ago

I've sat on this one for a bit and I don't think knowing that a file starts with BEGIN:VCALENDAR is enough to say you've validated it as iCal content.

I think if you need this in your code you should track it yourself.

axi commented 2 months ago

Ok. For reference, this would probably be the minimum for validating a ical content: https://stackoverflow.com/a/67698638/2454746