getTitle()); if (!empty($event->getDescription())) { $matches = []; preg_match_all('/
(.+)<\/p>/', $event->getDescription(), $matches); $isDescriptionStarted = false; foreach ($matches[1] as $match) { if (strlen(trim($match)) > 0) { if ($isDescriptionStarted) { echo $match . PHP_EOL; } else { echo sprintf('%s%s' . PHP_EOL, ICSFileReader::HEADER_DESCRIPTION, $match); $isDescriptionStarted = true; } } } } if (!is_null($event->getStartDate())) { $date = $event->getStartDate()->format('Ymd\\THis\\Z'); echo sprintf('%s%s' . PHP_EOL, ICSFileReader::HEADER_DATE, $date); } if (!is_null($event->getEndDate())) { $date = $event->getEndDate()->format('Ymd\\THis\\Z'); echo sprintf('%s%s' . PHP_EOL, ICSFileReader::HEADER_DATE_END, $date); } echo ICSFileReader::HEADER_VEVENT_END . PHP_EOL; } }