mibadger/enum

此包已废弃,不再维护。未建议替代包。

枚举组件

v3.0.0 2021-08-12 09:09 UTC

This package is auto-updated.

Last update: 2022-11-19 17:10:32 UTC


README

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

枚举组件。

示例

<?php

use miBadger\Enum\Enum;

/**
 * The example class.
 */
class Example extends Enum
{
	const A = 'a';
	const B = 'b';
}
<?php

/**
 * Returns the enum object with the specified name.
 */
$enum = new Example(Example::A);

/**
 * Returns the enum object with the specified name.
 */
$enum = Example::valueOf('A');

/**
 * Returns the ordinal.
 */
$enum->getOrdinal(); // 1

/**
 * Returns the name.
 */
$enum->getName(); // A

/**
 * Returns the value.
 */
$enum->getValue(); // a