limingxinleo/x-phalcon-enum

a phalcon enum component

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

This package is auto-updated.

Last update: 2024-10-19 19:16:08 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();