66use Obadiah \App ;
77use Obadiah \Bible \Day as Readings ;
88use Obadiah \Cache \Cache ;
9+ use Obadiah \Calendar \Event ;
910use Obadiah \Config \Config as C ;
1011use Obadiah \Helpers \Arr ;
1112use Obadiah \Helpers \Psalms ;
@@ -18,21 +19,23 @@ class Day
1819 /**
1920 * Create Day object.
2021 *
21- * @param DateTimeImmutable $date The date.
22- * @param Person[]|string[] $people Array of people.
23- * @param Readings|null $readings Bible readings.
22+ * @param DateTimeImmutable $date The date.
23+ * @param Person[]|string[] $people Array of people.
24+ * @param Event[] $events Array of people.
25+ * @param Readings|null $readings Bible readings.
2426 * @return void
2527 */
2628 public function __construct (
2729 public readonly DateTimeImmutable $ date ,
2830 public readonly array $ people ,
31+ public readonly array $ events ,
2932 public readonly ?Readings $ readings
3033 ) {}
3134
3235 /**
3336 * Build event summary.
3437 *
35- * @return string Event summary.
38+ * @return string Event summary.
3639 */
3740 public function get_summary (): string
3841 {
@@ -42,8 +45,8 @@ public function get_summary(): string
4245 /**
4346 * Build event description.
4447 *
45- * @param string $separator Line separator.
46- * @return string Event description.
48+ * @param string $separator Line separator.
49+ * @return string Event description.
4750 */
4851 public function get_description (string $ separator = "\\n " ): string
4952 {
@@ -68,6 +71,14 @@ public function get_description(string $separator = "\\n"): string
6871 $ description [] = "" ;
6972 }
7073
74+ // add events
75+ if (!empty ($ this ->events )) {
76+ $ description [] = "= Events & Groups = " ;
77+ $ events = Arr::map ($ this ->events , fn ($ e ) => sprintf ("%s - %s " , $ e ->start ->format (C::$ formats ->display_time ), $ e ->title ));
78+ $ description [] = join ($ separator , $ events );
79+ $ description [] = "" ;
80+ }
81+
7182 // add Collects
7283 if (($ collect = Cache::get_lectionary ()->get_collect ($ this ->date )) !== null ) {
7384 $ lines = preg_split ("/ \n/ " , $ collect );
0 commit comments