<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: core/contract/smart_contract.proto

namespace Protocol\SmartContract\ABI\Entry;

use UnexpectedValueException;

/**
 * Protobuf type <code>protocol.SmartContract.ABI.Entry.EntryType</code>
 */
class EntryType
{
    /**
     * Generated from protobuf enum <code>UnknownEntryType = 0;</code>
     */
    const UnknownEntryType = 0;
    /**
     * Generated from protobuf enum <code>Constructor = 1;</code>
     */
    const Constructor = 1;
    /**
     * Generated from protobuf enum <code>Function = 2;</code>
     */
    const PBFunction = 2;
    /**
     * Generated from protobuf enum <code>Event = 3;</code>
     */
    const Event = 3;
    /**
     * Generated from protobuf enum <code>Fallback = 4;</code>
     */
    const Fallback = 4;

    private static $valueToName = [
        self::UnknownEntryType => 'UnknownEntryType',
        self::Constructor => 'Constructor',
        self::PBFunction => 'PBFunction',
        self::Event => 'Event',
        self::Fallback => 'Fallback',
    ];

    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(EntryType::class, \Protocol\SmartContract_ABI_Entry_EntryType::class);

