roleType.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: common.proto
  4. namespace Common_pack;
  5. use UnexpectedValueException;
  6. /**
  7. * Protobuf type <code>common_pack.roleType</code>
  8. */
  9. class roleType
  10. {
  11. /**
  12. * Generated from protobuf enum <code>ROLE_TYPE_UNKNOWN = 0;</code>
  13. */
  14. const ROLE_TYPE_UNKNOWN = 0;
  15. /**
  16. * 无操作
  17. *
  18. * Generated from protobuf enum <code>RED = 1;</code>
  19. */
  20. const RED = 1;
  21. /**
  22. * Generated from protobuf enum <code>BLUE = 4;</code>
  23. */
  24. const BLUE = 4;
  25. /**
  26. * Generated from protobuf enum <code>YELLOW = 3;</code>
  27. */
  28. const YELLOW = 3;
  29. /**
  30. * Generated from protobuf enum <code>GREEN = 2;</code>
  31. */
  32. const GREEN = 2;
  33. private static $valueToName = [
  34. self::ROLE_TYPE_UNKNOWN => 'ROLE_TYPE_UNKNOWN',
  35. self::RED => 'RED',
  36. self::BLUE => 'BLUE',
  37. self::YELLOW => 'YELLOW',
  38. self::GREEN => 'GREEN',
  39. ];
  40. public static function name($value)
  41. {
  42. if (!isset(self::$valueToName[$value])) {
  43. throw new UnexpectedValueException(sprintf(
  44. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  45. }
  46. return self::$valueToName[$value];
  47. }
  48. public static function value($name)
  49. {
  50. $const = __CLASS__ . '::' . strtoupper($name);
  51. if (!defined($const)) {
  52. throw new UnexpectedValueException(sprintf(
  53. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  54. }
  55. return constant($const);
  56. }
  57. }