public static function callOriginal($callable, $args, $class = null)
{
if (is_array($callable)) {
if (is_object($callable[0])) {
$obj = $callable[0];
if (!$class) {
$class = get_class($obj);
}
} else {
$class = $callable[0];
}
$method = $callable[1];
} else {
if (is_scalar($callable) && strpos($callable, '::') !== false) {
list($class, $method) = explode("::", $callable);
} else {
return call_user_func_array($callable, $args);
}
}
try {
$Rm = new \ReflectionMethod($class, $method);
if ($Rm->isUserDefined()) {
self::$temp_disable = true;
// we can only mock and check for mocks for user defined methods
}
} catch (\ReflectionException $e) {
// do nothing, it is ok in this case because it means that mock disabling is not needed
}
if (isset($obj)) {
return self::callMethod($obj, $class, $method, $args);
} else {
return self::callStaticMethod($class, $method, $args);
}
}