limingxinleo/x-phalcon-enum

a phalcon enum component

v1.2.0 2021-01-19 10:46 UTC

This package is auto-updated.

Last update: 2021-04-19 11:22:54 UTC


README

Build Status

安装

composer require limingxinleo/x-phalcon-enum

使用

定义枚举类

use Xin\Phalcon\Enum\Enum;

class ErrorCode extends Enum
{
    /**
     * @Message('非法的TOKEN')
     */
    public static $ENUM_INVALID_TOKEN = 700;
}

获取单个枚举

$code = ErrorCode::$ENUM_INVALID_TOKEN;
$message = ErrorCode::getMessage($code);

获取枚举数组


$message = ErrorCode::toArray();