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

namespace Google\Cloud\Language\V1\Document;

use UnexpectedValueException;

/**
 * The document types enum.
 *
 * Protobuf type <code>google.cloud.language.v1.Document.Type</code>
 */
class Type
{
    /**
     * The content type is not specified.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Plain text
     *
     * Generated from protobuf enum <code>PLAIN_TEXT = 1;</code>
     */
    const PLAIN_TEXT = 1;
    /**
     * HTML
     *
     * Generated from protobuf enum <code>HTML = 2;</code>
     */
    const HTML = 2;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::PLAIN_TEXT => 'PLAIN_TEXT',
        self::HTML => 'HTML',
    ];

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

