Codec.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_topic.proto
  4. namespace Ydb\Topic;
  5. use UnexpectedValueException;
  6. /**
  7. * Protobuf type <code>Ydb.Topic.Codec</code>
  8. */
  9. class Codec
  10. {
  11. /**
  12. * Generated from protobuf enum <code>CODEC_UNSPECIFIED = 0;</code>
  13. */
  14. const CODEC_UNSPECIFIED = 0;
  15. /**
  16. * Generated from protobuf enum <code>CODEC_RAW = 1;</code>
  17. */
  18. const CODEC_RAW = 1;
  19. /**
  20. * Generated from protobuf enum <code>CODEC_GZIP = 2;</code>
  21. */
  22. const CODEC_GZIP = 2;
  23. /**
  24. * Generated from protobuf enum <code>CODEC_LZOP = 3;</code>
  25. */
  26. const CODEC_LZOP = 3;
  27. /**
  28. * Generated from protobuf enum <code>CODEC_ZSTD = 4;</code>
  29. */
  30. const CODEC_ZSTD = 4;
  31. /**
  32. * User-defined codecs from 10000 to 19999
  33. *
  34. * Generated from protobuf enum <code>CODEC_CUSTOM = 10000;</code>
  35. */
  36. const CODEC_CUSTOM = 10000;
  37. private static $valueToName = [
  38. self::CODEC_UNSPECIFIED => 'CODEC_UNSPECIFIED',
  39. self::CODEC_RAW => 'CODEC_RAW',
  40. self::CODEC_GZIP => 'CODEC_GZIP',
  41. self::CODEC_LZOP => 'CODEC_LZOP',
  42. self::CODEC_ZSTD => 'CODEC_ZSTD',
  43. self::CODEC_CUSTOM => 'CODEC_CUSTOM',
  44. ];
  45. public static function name($value)
  46. {
  47. if (!isset(self::$valueToName[$value])) {
  48. throw new UnexpectedValueException(sprintf(
  49. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  50. }
  51. return self::$valueToName[$value];
  52. }
  53. public static function value($name)
  54. {
  55. $const = __CLASS__ . '::' . strtoupper($name);
  56. if (!defined($const)) {
  57. throw new UnexpectedValueException(sprintf(
  58. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  59. }
  60. return constant($const);
  61. }
  62. }