for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DiceCalc;
/**
* Class Random
*
* @package DiceCalc
* @author Owen Winkler <[email protected]>
* @license MIT http://opensource.org/licenses/MIT
*/
class Random {
public static $queue = null;
public static $queue_list = [];
public static function get($min, $max) {
if(is_callable(self::$queue)) {
$test_fn = self::$queue;
$result = $test_fn($min, $max);
}
else {
$result = mt_rand($min, $max);
return $result;
public static function set_queue($queue) {
self::$queue = $queue;
public static function clear_queue() {
self::$queue = null;
public static function queue_up() {
$numbers = func_get_args();
self::$queue_list = self::$queue_list + $numbers;
self::set_queue(function($min, $max){
$min
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$max
return array_shift(self::$queue_list);
});
public static function queue_min() {
self::set_queue(function($min, $max) {
return $min;
public static function queue_max() {
return $max;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.