public function AvailabilityCalendarICalFeedsParser::parse in Availability Calendars 7.5
Implements FeedsParser::parse().
Parameters
\FeedsSource $source:
\FeedsFetcherResult $fetcher_result:
Return value
Throws
\Exception
File
- ./
AvailabilityCalendarICalFeedsParser.inc, line 18
Class
- AvailabilityCalendarICalFeedsParser
- @class ICalendar parser for availability calendars.
Code
public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
$state = $source
->state(FEEDS_PARSE);
// Read the iCal feed into memory.
$ical_feed_contents = $fetcher_result
->getRaw();
$vevents = $this
->parseVcalendar($ical_feed_contents);
// Report progress.
// We need to add 1 to the index of the last parsed component so that
// the subsequent batch starts on the first unparsed component.
$state
->progress($state->total, $state->pointer);
// All the vevents are to be handled as just 1 item with 1 field.
return new FeedsParserResult(array(
array(
'vcalendar' => $vevents,
),
));
}