Format.php 1.4 KB

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