Add enum MDAppTokenSection
This commit is contained in:
parent
d0cf8d26b3
commit
4ad756e19d
|
@ -8,3 +8,7 @@ museum-digital.
|
||||||
|
|
||||||
- Licenses
|
- Licenses
|
||||||
- Languages
|
- 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).
|
||||||
|
|
34
src/enums/MDAppTokenSection.php
Normal file
34
src/enums/MDAppTokenSection.php
Normal 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user