, more: int, url: string, link: string}> $sections */ public function __construct(public bool $weekly, public array $sections) {} public function envelope(): Envelope { $title = $this->weekly ? 'Wochenübersicht KW '.now()->isoWeek() : 'Tagesübersicht '.now()->format('d.m.Y'); $count = array_sum(array_map(fn (array $section): int => count($section['items']) + $section['more'], $this->sections)); return new Envelope( subject: $title.($count === 0 ? ': nichts Neues' : ": {$count} ".($count === 1 ? 'Punkt' : 'Punkte')), ); } public function content(): Content { return new Content( markdown: 'mail.digest', ); } }