summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Trace/V1/Status/StatusCode.php
blob: 954cf1fd20d44bfa2e8a712acacc39e75a33409b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/trace/v1/trace.proto

namespace Opentelemetry\Proto\Trace\V1\Status;

use UnexpectedValueException;

/**
 * For the semantics of status codes see
 * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
 *
 * Protobuf type <code>opentelemetry.proto.trace.v1.Status.StatusCode</code>
 */
class StatusCode
{
    /**
     * The default status.
     *
     * Generated from protobuf enum <code>STATUS_CODE_UNSET = 0;</code>
     */
    const STATUS_CODE_UNSET = 0;
    /**
     * The Span has been validated by an Application developer or Operator to 
     * have completed successfully.
     *
     * Generated from protobuf enum <code>STATUS_CODE_OK = 1;</code>
     */
    const STATUS_CODE_OK = 1;
    /**
     * The Span contains an error.
     *
     * Generated from protobuf enum <code>STATUS_CODE_ERROR = 2;</code>
     */
    const STATUS_CODE_ERROR = 2;

    private static $valueToName = [
        self::STATUS_CODE_UNSET => 'STATUS_CODE_UNSET',
        self::STATUS_CODE_OK => 'STATUS_CODE_OK',
        self::STATUS_CODE_ERROR => 'STATUS_CODE_ERROR',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StatusCode::class, \Opentelemetry\Proto\Trace\V1\Status_StatusCode::class);