mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-22 04:38:09 +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 );
|
|
}
|
|
} |