| Conditions | 5 |
| Paths | 16 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function generate(Link $link): string |
||
| 22 | { |
||
| 23 | $url = static::BASE_URL; |
||
| 24 | |||
| 25 | $dateTimeFormat = $link->allDay ? $this->dateFormat : $this->dateTimeFormat; |
||
| 26 | |||
| 27 | $utcStartDateTime = (clone $link->from)->setTimezone(new DateTimeZone('UTC')); |
||
| 28 | $utcEndDateTime = (clone $link->to)->setTimezone(new DateTimeZone('UTC')); |
||
| 29 | |||
| 30 | $url .= '&startdt='.$utcStartDateTime->format($dateTimeFormat); |
||
| 31 | $url .= '&enddt='.$utcEndDateTime->format($dateTimeFormat); |
||
| 32 | |||
| 33 | if ($link->allDay) { |
||
| 34 | $url .= '&allday=true'; |
||
| 35 | } |
||
| 36 | |||
| 37 | $url .= '&subject='.urlencode($link->title); |
||
| 38 | |||
| 39 | if ($link->description) { |
||
| 40 | $url .= '&body='.urlencode($link->description); |
||
| 41 | } |
||
| 42 | |||
| 43 | if ($link->address) { |
||
| 44 | $url .= '&location='.urlencode($link->address); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $url; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |