public static function assertCallback($callback, $callee, $parameterPosition)
{
if (!is_callable($callback)) {
if (!is_array($callback) && !is_string($callback)) {
throw new static(sprintf('%s() expected parameter %d to be a valid callback, no array, string, closure or functor given', $callee, $parameterPosition));
}
$type = gettype($callback);
switch ($type) {
case 'array':
$type = 'method';
$callback = array_values($callback);
$sep = '::';
if (is_object($callback[0])) {
$callback[0] = get_class($callback[0]);
$sep = '->';
}
$callback = join($callback, $sep);
break;
default:
$type = 'function';
break;
}
throw new static(sprintf("%s() expects parameter %d to be a valid callback, %s '%s' not found or invalid %s name", $callee, $parameterPosition, $type, $callback, $type));
}
}