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

namespace Google\Cloud\Build\V1\BuildOptions;

use UnexpectedValueException;

/**
 * Specifies the behavior when there is an error in the substitution checks.
 *
 * Protobuf type <code>google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption</code>
 */
class SubstitutionOption
{
    /**
     * Fails the build if error in substitutions checks, like missing
     * a substitution in the template or in the map.
     *
     * Generated from protobuf enum <code>MUST_MATCH = 0;</code>
     */
    const MUST_MATCH = 0;
    /**
     * Do not fail the build if error in substitutions checks.
     *
     * Generated from protobuf enum <code>ALLOW_LOOSE = 1;</code>
     */
    const ALLOW_LOOSE = 1;

    private static $valueToName = [
        self::MUST_MATCH => 'MUST_MATCH',
        self::ALLOW_LOOSE => 'ALLOW_LOOSE',
    ];

    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(SubstitutionOption::class, \Google\Cloud\Build\V1\BuildOptions_SubstitutionOption::class);

