From 4ad756e19d4cae4677cb827158ec9142b643abd8 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 24 Jul 2022 01:23:41 +0200 Subject: [PATCH] Add enum MDAppTokenSection --- README.md | 4 ++++ src/enums/MDAppTokenSection.php | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/enums/MDAppTokenSection.php diff --git a/README.md b/README.md index fcb5463..7e97078 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,7 @@ museum-digital. - Licenses - Languages + +## Enums + +As of PHP 8.1, PHP now supports enums. A new folder has been added in /src/enums to gather those types of new entries, that can be better expressed using enums at no direct loss (mainly in listing translated options). diff --git a/src/enums/MDAppTokenSection.php b/src/enums/MDAppTokenSection.php new file mode 100644 index 0000000..5f03be1 --- /dev/null +++ b/src/enums/MDAppTokenSection.php @@ -0,0 +1,34 @@ + + */ +declare(strict_types = 1); + +/** + * Sections of musdb for which alternative output formats are available, + * that can be used with an app token. + */ +enum MDAppTokenSection { + + case webcal; + + /** + * Lists all available names. + * + * @return array + */ + public static function caseNames():array { + + $output = []; + + $cases = self::cases(); + foreach ($cases as $case) { + $output[] = $case->name; + } + + return $output; + + } +}