Conditions | 3 |
Paths | 4 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
14 | 2 | public function exportEvent(Event $event): string |
|
15 | { |
||
16 | $data = [ |
||
17 | 2 | 'SUMMARY' => $event->getSummary(), |
|
18 | 2 | 'DESCRIPTION' => $event->getDescription(), |
|
19 | 2 | 'DTSTART' => $event->getStartAt(), |
|
20 | 2 | 'DTEND' => $event->getEndAt(), |
|
21 | ]; |
||
22 | 2 | if (null !== $event->getClassification()) { |
|
23 | 1 | $data['CLASS'] = $event->getClassification(); |
|
24 | } |
||
25 | |||
26 | 2 | if ($event->isRecurring()) { |
|
27 | 1 | $data['RRULE'] = $event->getRecurrenceRule()->getParts(); |
|
28 | } |
||
29 | |||
30 | 2 | $vcalendar = new VObject\Component\VCalendar([ |
|
31 | 2 | 'VEVENT' => $data, |
|
32 | ]); |
||
33 | |||
34 | 2 | return $vcalendar->serialize(); |
|
35 | } |
||
36 | } |
||
37 |