mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +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);
|
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