Unit.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_table.proto
  4. namespace Ydb\Table\ValueSinceUnixEpochModeSettings;
  5. use UnexpectedValueException;
  6. /**
  7. * Protobuf type <code>Ydb.Table.ValueSinceUnixEpochModeSettings.Unit</code>
  8. */
  9. class Unit
  10. {
  11. /**
  12. * Generated from protobuf enum <code>UNIT_UNSPECIFIED = 0;</code>
  13. */
  14. const UNIT_UNSPECIFIED = 0;
  15. /**
  16. * Generated from protobuf enum <code>UNIT_SECONDS = 1;</code>
  17. */
  18. const UNIT_SECONDS = 1;
  19. /**
  20. * Generated from protobuf enum <code>UNIT_MILLISECONDS = 2;</code>
  21. */
  22. const UNIT_MILLISECONDS = 2;
  23. /**
  24. * Generated from protobuf enum <code>UNIT_MICROSECONDS = 3;</code>
  25. */
  26. const UNIT_MICROSECONDS = 3;
  27. /**
  28. * Generated from protobuf enum <code>UNIT_NANOSECONDS = 4;</code>
  29. */
  30. const UNIT_NANOSECONDS = 4;
  31. private static $valueToName = [
  32. self::UNIT_UNSPECIFIED => 'UNIT_UNSPECIFIED',
  33. self::UNIT_SECONDS => 'UNIT_SECONDS',
  34. self::UNIT_MILLISECONDS => 'UNIT_MILLISECONDS',
  35. self::UNIT_MICROSECONDS => 'UNIT_MICROSECONDS',
  36. self::UNIT_NANOSECONDS => 'UNIT_NANOSECONDS',
  37. ];
  38. public static function name($value)
  39. {
  40. if (!isset(self::$valueToName[$value])) {
  41. throw new UnexpectedValueException(sprintf(
  42. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  43. }
  44. return self::$valueToName[$value];
  45. }
  46. public static function value($name)
  47. {
  48. $const = __CLASS__ . '::' . strtoupper($name);
  49. if (!defined($const)) {
  50. throw new UnexpectedValueException(sprintf(
  51. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  52. }
  53. return constant($const);
  54. }
  55. }
  56. // Adding a class alias for backwards compatibility with the previous class name.
  57. class_alias(Unit::class, \Ydb\Table\ValueSinceUnixEpochModeSettings_Unit::class);