<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: analyticsTrackedEvents.proto

namespace Rv\Analytics\Trackedevents\EditorObjectAdded;

use UnexpectedValueException;

/**
 * Protobuf type <code>rv.analytics.trackedevents.EditorObjectAdded.FromInsertionSource</code>
 */
class FromInsertionSource
{
    /**
     * Generated from protobuf enum <code>EDITOR_TOOLBAR = 0;</code>
     */
    const EDITOR_TOOLBAR = 0;
    /**
     * Generated from protobuf enum <code>EDITOR_MAIN_MENU = 1;</code>
     */
    const EDITOR_MAIN_MENU = 1;
    /**
     * Generated from protobuf enum <code>EDITOR_HOTKEY = 2;</code>
     */
    const EDITOR_HOTKEY = 2;
    /**
     * Generated from protobuf enum <code>EDITOR_COPY_PASTE = 3;</code>
     */
    const EDITOR_COPY_PASTE = 3;

    private static $valueToName = [
        self::EDITOR_TOOLBAR => 'EDITOR_TOOLBAR',
        self::EDITOR_MAIN_MENU => 'EDITOR_MAIN_MENU',
        self::EDITOR_HOTKEY => 'EDITOR_HOTKEY',
        self::EDITOR_COPY_PASTE => 'EDITOR_COPY_PASTE',
    ];

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

