Mode.php 1.5 KB

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