Reason.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_topic.proto
  4. namespace Ydb\Topic\StreamWriteMessage\WriteResponse\WriteAck\Skipped;
  5. use UnexpectedValueException;
  6. /**
  7. * Protobuf type <code>Ydb.Topic.StreamWriteMessage.WriteResponse.WriteAck.Skipped.Reason</code>
  8. */
  9. class Reason
  10. {
  11. /**
  12. * Generated from protobuf enum <code>REASON_UNSPECIFIED = 0;</code>
  13. */
  14. const REASON_UNSPECIFIED = 0;
  15. /**
  16. * Generated from protobuf enum <code>REASON_ALREADY_WRITTEN = 1;</code>
  17. */
  18. const REASON_ALREADY_WRITTEN = 1;
  19. private static $valueToName = [
  20. self::REASON_UNSPECIFIED => 'REASON_UNSPECIFIED',
  21. self::REASON_ALREADY_WRITTEN => 'REASON_ALREADY_WRITTEN',
  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(Reason::class, \Ydb\Topic\StreamWriteMessage_WriteResponse_WriteAck_Skipped_Reason::class);