60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| # Generated by the protocol buffer compiler.  DO NOT EDIT!
 | |
| # source: proto/auth.proto
 | |
| 
 | |
| namespace GRPC\Auth;
 | |
| 
 | |
| use UnexpectedValueException;
 | |
| 
 | |
| /**
 | |
|  * 账户角色类型
 | |
|  *
 | |
|  * Protobuf type <code>auth.AccountRole</code>
 | |
|  */
 | |
| class AccountRole
 | |
| {
 | |
|     /**
 | |
|      * Generated from protobuf enum <code>ACCOUNT_ROLE_UNSPECIFIED = 0;</code>
 | |
|      */
 | |
|     const ACCOUNT_ROLE_UNSPECIFIED = 0;
 | |
|     /**
 | |
|      * 管理员
 | |
|      *
 | |
|      * Generated from protobuf enum <code>ACCOUNT_ROLE_MANAGER = 1;</code>
 | |
|      */
 | |
|     const ACCOUNT_ROLE_MANAGER = 1;
 | |
|     /**
 | |
|      * 普通员工
 | |
|      *
 | |
|      * Generated from protobuf enum <code>ACCOUNT_ROLE_STAFF = 2;</code>
 | |
|      */
 | |
|     const ACCOUNT_ROLE_STAFF = 2;
 | |
| 
 | |
|     private static $valueToName = [
 | |
|         self::ACCOUNT_ROLE_UNSPECIFIED => 'ACCOUNT_ROLE_UNSPECIFIED',
 | |
|         self::ACCOUNT_ROLE_MANAGER => 'ACCOUNT_ROLE_MANAGER',
 | |
|         self::ACCOUNT_ROLE_STAFF => 'ACCOUNT_ROLE_STAFF',
 | |
|     ];
 | |
| 
 | |
|     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);
 | |
|     }
 | |
| }
 | |
| 
 |