• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?php
2# Generated by the protocol buffer compiler.  DO NOT EDIT!
3# source: src/proto/grpc/testing/messages.proto
4
5namespace Grpc\Testing\HookRequest;
6
7use UnexpectedValueException;
8
9/**
10 * Protobuf type <code>grpc.testing.HookRequest.HookRequestCommand</code>
11 */
12class HookRequestCommand
13{
14    /**
15     * Default value
16     *
17     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
18     */
19    const UNSPECIFIED = 0;
20    /**
21     * Start the HTTP endpoint
22     *
23     * Generated from protobuf enum <code>START = 1;</code>
24     */
25    const START = 1;
26    /**
27     * Stop
28     *
29     * Generated from protobuf enum <code>STOP = 2;</code>
30     */
31    const STOP = 2;
32    /**
33     * Return from HTTP GET/POST
34     *
35     * Generated from protobuf enum <code>RETURN = 3;</code>
36     */
37    const PBRETURN = 3;
38
39    private static $valueToName = [
40        self::UNSPECIFIED => 'UNSPECIFIED',
41        self::START => 'START',
42        self::STOP => 'STOP',
43        self::PBRETURN => 'RETURN',
44    ];
45
46    public static function name($value)
47    {
48        if (!isset(self::$valueToName[$value])) {
49            throw new UnexpectedValueException(sprintf(
50                    'Enum %s has no name defined for value %s', __CLASS__, $value));
51        }
52        return self::$valueToName[$value];
53    }
54
55
56    public static function value($name)
57    {
58        $const = __CLASS__ . '::' . strtoupper($name);
59        if (!defined($const)) {
60            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
61            if (!defined($pbconst)) {
62                throw new UnexpectedValueException(sprintf(
63                        'Enum %s has no value defined for name %s', __CLASS__, $name));
64            }
65            return constant($pbconst);
66        }
67        return constant($const);
68    }
69}
70
71// Adding a class alias for backwards compatibility with the previous class name.
72class_alias(HookRequestCommand::class, \Grpc\Testing\HookRequest_HookRequestCommand::class);
73
74