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

namespace Couchbase\Protostellar\Generated\Search\V1\MatchQuery;

use UnexpectedValueException;

/**
 * Protobuf type <code>couchbase.search.v1.MatchQuery.Operator</code>
 */
class Operator
{
    /**
     * Generated from protobuf enum <code>OPERATOR_OR = 0;</code>
     */
    const OPERATOR_OR = 0;
    /**
     * Generated from protobuf enum <code>OPERATOR_AND = 1;</code>
     */
    const OPERATOR_AND = 1;

    private static $valueToName = [
        self::OPERATOR_OR => 'OPERATOR_OR',
        self::OPERATOR_AND => 'OPERATOR_AND',
    ];

    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(Operator::class, \Couchbase\Protostellar\Generated\Search\V1\MatchQuery_Operator::class);

