| Conditions | 4 |
| Paths | 8 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function generate(Link $link): string |
||
| 19 | { |
||
| 20 | $url = 'https://calendar.google.com/calendar/render?action=TEMPLATE'; |
||
| 21 | |||
| 22 | $dateTimeFormat = $link->allDay ? $this->dateFormat : $this->dateTimeFormat; |
||
| 23 | $url .= '&dates='.$link->from->format($dateTimeFormat).'/'.$link->to->format($dateTimeFormat); |
||
| 24 | $url .= '&ctz='.$link->from->getTimezone()->getName(); |
||
| 25 | |||
| 26 | $url .= '&text='.urlencode($link->title); |
||
| 27 | |||
| 28 | if ($link->description) { |
||
| 29 | $url .= '&details='.urlencode($link->description); |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($link->address) { |
||
| 33 | $url .= '&location='.urlencode($link->address); |
||
| 34 | } |
||
| 35 | |||
| 36 | $url .= '&sprop=&sprop=name:'; |
||
| 37 | |||
| 38 | return $url; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |