<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/logging/v2/logging_metrics.proto

namespace Google\Cloud\Logging\V2\LogMetric;

use UnexpectedValueException;

/**
 * Logging API version.
 *
 * Protobuf type <code>google.logging.v2.LogMetric.ApiVersion</code>
 */
class ApiVersion
{
    /**
     * Logging API v2.
     *
     * Generated from protobuf enum <code>V2 = 0;</code>
     */
    const V2 = 0;
    /**
     * Logging API v1.
     *
     * Generated from protobuf enum <code>V1 = 1;</code>
     */
    const V1 = 1;

    private static $valueToName = [
        self::V2 => 'V2',
        self::V1 => 'V1',
    ];

    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);
    }
}

