123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\Enum;
- /**
- * 全局状态枚举
- */
- class UserEnum
- {
- const GENDER_MALE = 1; // 男
- const GENDER_FEMALE = 2; // 女
- const GENDER_UNKNOWN = 0; // 未知
- public static function getGenderMap()
- {
- return [
- self::GENDER_MALE => '男',
- self::GENDER_FEMALE => '女',
- self::GENDER_UNKNOWN => '未知',
- ];
- }
- public static function getGenderText($gender)
- {
- return self::getGenderMap()[$gender] ?? '未知';
- }
- public static function getGenderList()
- {
- return [
- self::GENDER_MALE,
- self::GENDER_FEMALE,
- self::GENDER_UNKNOWN,
- ];
- }
- }
|