Add enum MDAppTokenSection

This commit is contained in:
Joshua Ramon Enslin 2022-07-24 01:23:41 +02:00
parent d0cf8d26b3
commit 4ad756e19d
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 38 additions and 0 deletions

View File

@ -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).

View File

@ -0,0 +1,34 @@
<?PHP
/**
* Lists the types of functionalities for which app tokens can be used in musdb.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
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<string>
*/
public static function caseNames():array {
$output = [];
$cases = self::cases();
foreach ($cases as $case) {
$output[] = $case->name;
}
return $output;
}
}