private function getDelayedCall($check, $subject, array $arguments)
{
$exception = $this->getException($arguments);
$unwrapper = $this->unwrapper;
return new DelayedCall(function ($method, $arguments) use($check, $subject, $exception, $unwrapper) {
$arguments = $unwrapper->unwrapAll($arguments);
$methodName = $arguments[0];
$arguments = isset($arguments[1]) ? $arguments[1] : array();
$callable = array($subject, $methodName);
list($class, $methodName) = array($subject, $methodName);
if (!method_exists($class, $methodName) && !method_exists($class, '__call')) {
throw new MethodNotFoundException(sprintf('Method %s::%s not found.', get_class($class), $methodName), $class, $methodName, $arguments);
}
return call_user_func($check, $callable, $arguments, $exception);
});
}