mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Implement random
This commit is contained in:
parent
e412e3935d
commit
e46592a23e
|
|
@ -84,4 +84,19 @@ abstract class Enum
|
|||
return in_array($value, $values, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get random enum value.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getRandom()
|
||||
{
|
||||
$constants = self::getConstants();
|
||||
|
||||
return $this->constants[mt_rand(0, count($constants))];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user