Skip to content

Commit

Permalink
[feature/663/calendarname] FEATURE : Adds the ability to add a name t…
Browse files Browse the repository at this point in the history
…o the calendar. Using the X-WR-CALNAME property. Fixes #663
  • Loading branch information
Luc MULLER committed Jan 21, 2025
1 parent 07e1269 commit 5224efe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Domain/Entity/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Calendar
{
private string $productIdentifier = '-//eluceo/ical//2.0/EN';

private string $calName;

private ?DateInterval $publishedTTL = null;

private Events $events;
Expand Down Expand Up @@ -83,6 +85,18 @@ public function setProductIdentifier(string $productIdentifier): self
return $this;
}

public function getCalName(): string
{
return $this->calName;
}

public function setCalName(string $calName): self
{
$this->calName = $calName;

return $this;
}

public function getEvents(): Events
{
return $this->events;
Expand Down
2 changes: 2 additions & 0 deletions src/Presentation/Factory/CalendarFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected function getProperties(Calendar $calendar): Generator
/* @see https://www.ietf.org/rfc/rfc5545.html#section-3.7.1 */
yield new Property('CALSCALE', new TextValue('GREGORIAN'));
$publishedTTL = $calendar->getPublishedTTL();
// The calendar name is not part of the RFC but is used by some clients.
yield new Property('X-WR-CALNAME', new TextValue($calendar->getCalName()));
if ($publishedTTL) {
/* @see http://msdn.microsoft.com/en-us/library/ee178699(v=exchg.80).aspx */
yield new Property('X-PUBLISHED-TTL', new DurationValue($publishedTTL));
Expand Down

0 comments on commit 5224efe

Please sign in to comment.