From 63895258ad57c1cb644b349bea691d59051a078c Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 25 Jan 2023 00:16:31 +0100 Subject: [PATCH] Add functions for getting JSON-LD representations of MDAppointmentCancellationStatus and MDAttendanceStatus --- src/enums/MDAppointmentCancellationStatus.php | 15 +++++++++++++++ src/enums/MDAttendanceStatus.php | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/enums/MDAppointmentCancellationStatus.php b/src/enums/MDAppointmentCancellationStatus.php index 31a585a..47381ed 100644 --- a/src/enums/MDAppointmentCancellationStatus.php +++ b/src/enums/MDAppointmentCancellationStatus.php @@ -97,6 +97,21 @@ enum MDAppointmentCancellationStatus implements MDValueEnumInterface, JsonSerial } + /** + * Returns the JSON-LD representation of the attendance mode. + * + * @return string + */ + public function getJsonLd():string { + + return match($this) { + self::scheduled_done => "https://schema.org/EventScheduled", + self::cancelled => "https://schema.org/EventCancelled", + default => throw new MDpageParameterNotFromListException("Unknown JSON LD for attendance status"), + }; + + } + /** * Provides the option to serialize as a string during json_encode(). * diff --git a/src/enums/MDAttendanceStatus.php b/src/enums/MDAttendanceStatus.php index a064741..dfc19d9 100644 --- a/src/enums/MDAttendanceStatus.php +++ b/src/enums/MDAttendanceStatus.php @@ -97,6 +97,21 @@ enum MDAttendanceStatus implements MDValueEnumInterface, JsonSerializable { } + /** + * Returns the JSON-LD representation of the attendance mode. + * + * @return string + */ + public function getJsonLd():string { + + return match($this) { + self::online => "https://schema.org/OnlineEventAttendanceMode", + self::offline => "https://schema.org/OfflineEventAttendanceMode", + default => throw new MDpageParameterNotFromListException("Unknown JSON LD for attendance status"), + }; + + } + /** * Provides the option to serialize as a string during json_encode(). *