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

namespace Google\Api;

use UnexpectedValueException;

/**
 * The behavior to take when the flow control limit is exceeded.
 *
 * Protobuf type <code>google.api.FlowControlLimitExceededBehaviorProto</code>
 */
class FlowControlLimitExceededBehaviorProto
{
    /**
     * Default behavior, system-defined.
     *
     * Generated from protobuf enum <code>UNSET_BEHAVIOR = 0;</code>
     */
    const UNSET_BEHAVIOR = 0;
    /**
     * Stop operation, raise error.
     *
     * Generated from protobuf enum <code>THROW_EXCEPTION = 1;</code>
     */
    const THROW_EXCEPTION = 1;
    /**
     * Pause operation until limit clears.
     *
     * Generated from protobuf enum <code>BLOCK = 2;</code>
     */
    const BLOCK = 2;
    /**
     * Continue operation, disregard limit.
     *
     * Generated from protobuf enum <code>IGNORE = 3;</code>
     */
    const IGNORE = 3;

    private static $valueToName = [
        self::UNSET_BEHAVIOR => 'UNSET_BEHAVIOR',
        self::THROW_EXCEPTION => 'THROW_EXCEPTION',
        self::BLOCK => 'BLOCK',
        self::IGNORE => 'IGNORE',
    ];

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

