Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/Domain/Entity/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
class Calendar
{
private string $productIdentifier = '-//eluceo/ical//2.0/EN';
private string $calendarName = '';
private string $calendarDescription = '';

private Events $events;

Expand Down Expand Up @@ -68,6 +70,30 @@ public function setProductIdentifier(string $productIdentifier): self
return $this;
}

public function getCalendarName(): string
{
return $this->calendarName;
}

public function setCalendarName(string $calendarName): self
{
$this->calendarName = $calendarName;

return $this;
}

public function getCalendarDescription(): string
{
return $this->calendarDescription;
}

public function setCalendarDescription(string $calendarDescription): self
{
$this->calendarDescription = $calendarDescription;

return $this;
}

public function getEvents(): Events
{
return $this->events;
Expand Down
8 changes: 8 additions & 0 deletions src/Presentation/Factory/CalendarFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@ private function getProperties(Calendar $calendar): Generator
yield new Property('VERSION', new TextValue('2.0'));
/* @see https://www.ietf.org/rfc/rfc5545.html#section-3.7.1 */
yield new Property('CALSCALE', new TextValue('GREGORIAN'));

if(!empty($calendar->getCalendarName())) {
yield new Property('X-WR-CALNAME', new TextValue($calendar->getCalendarName()));
}

if(!empty($calendar->getCalendarDescription())) {
yield new Property('X-WR-CALDESC', new TextValue($calendar->getCalendarDescription()));
}
}
}