Skip to content
Snippets Groups Projects
Commit 32d4210c authored by Peter Rotich's avatar Peter Rotich
Browse files

Sanity check for callable check

Make sure the check is callable
Use call_user_func_array when calling user defined function
parent ab022000
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,17 @@ class Sequence extends VerySimpleModel {
*/
function next($format=false, $check=false) {
$digits = $format ? $this->getDigitCount($format) : false;
if ($check && !is_callable($check))
$check = false;
do {
$next = $this->__next($digits);
$formatted = $format ? $this->format($format, $next) : $next;
}
while ($check && !$check($formatted, $next));
while ($check
&& !call_user_func_array($check, array($formatted, $next)));
return $formatted;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment