fatcode / enum
为鉴赏家设计的枚举库。
1.1.0
2019-03-26 18:50 UTC
Requires
- php: >=7.2.0
Requires (Dev)
- phpunit/phpunit: >=8.0
- squizlabs/php_codesniffer: >=3.0
This package is auto-updated.
Last update: 2024-09-11 22:33:19 UTC
README
为鉴赏家设计的枚举库。
安装
composer install fatcode/enum
枚举声明
<?php use FatCode\Enum; class Colors extends Enum { public const RED = 'red'; public const GREEN = 'green'; protected const INVISIBLE_COLOR = 'invisible_color'; }
枚举使用
<?php // $red is instance of Enum with value 'red' $red = Colors::RED(); $red->getValue(); // "red" $red->getKey();// "RED"