mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-25 06:00:28 +01:00
14 lines
No EOL
373 B
PHP
14 lines
No EOL
373 B
PHP
<?php
|
|
|
|
namespace OCA\OrganizationFolders\Enum;
|
|
|
|
trait FromNameEnum {
|
|
public static function fromName(string $name): string {
|
|
foreach (self::cases() as $status) {
|
|
if( $name === $status->name ){
|
|
return $status->value;
|
|
}
|
|
}
|
|
throw new \ValueError("$name is not a valid value for enum " . self::class );
|
|
}
|
|
} |