blob: ce3c062c691df91b2c29019d493fc377e04e5609 [file] [log] [blame]
avm9996399bb77c2020-01-27 03:15:08 +01001<?php
2# Generated by the protocol buffer compiler. DO NOT EDIT!
3# source: google/protobuf/descriptor.proto
4
5namespace Google\Protobuf\Internal\MethodOptions;
6
7use UnexpectedValueException;
8
9/**
10 * Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
11 * or neither? HTTP based RPC implementation may choose GET verb for safe
12 * methods, and PUT verb for idempotent methods instead of the default POST.
13 *
14 * Protobuf type <code>google.protobuf.MethodOptions.IdempotencyLevel</code>
15 */
16class IdempotencyLevel
17{
18 /**
19 * Generated from protobuf enum <code>IDEMPOTENCY_UNKNOWN = 0;</code>
20 */
21 const IDEMPOTENCY_UNKNOWN = 0;
22 /**
23 * implies idempotent
24 *
25 * Generated from protobuf enum <code>NO_SIDE_EFFECTS = 1;</code>
26 */
27 const NO_SIDE_EFFECTS = 1;
28 /**
29 * idempotent, but may have side effects
30 *
31 * Generated from protobuf enum <code>IDEMPOTENT = 2;</code>
32 */
33 const IDEMPOTENT = 2;
34
35 private static $valueToName = [
36 self::IDEMPOTENCY_UNKNOWN => 'IDEMPOTENCY_UNKNOWN',
37 self::NO_SIDE_EFFECTS => 'NO_SIDE_EFFECTS',
38 self::IDEMPOTENT => 'IDEMPOTENT',
39 ];
40
41 public static function name($value)
42 {
43 if (!isset(self::$valueToName[$value])) {
44 throw new UnexpectedValueException(sprintf(
45 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 }
47 return self::$valueToName[$value];
48 }
49
50
51 public static function value($name)
52 {
53 $const = __CLASS__ . '::' . strtoupper($name);
54 if (!defined($const)) {
55 throw new UnexpectedValueException(sprintf(
56 'Enum %s has no value defined for name %s', __CLASS__, $name));
57 }
58 return constant($const);
59 }
60}
61
62// Adding a class alias for backwards compatibility with the previous class name.
63class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class);
64