private function getException(array $arguments)
{
if (0 === count($arguments)) {
return null;
}
if (is_string($arguments[0])) {
return $arguments[0];
}
if (is_object($arguments[0])) {
if ($arguments[0] instanceof \Throwable) {
return $arguments[0];
} elseif ($arguments[0] instanceof \Exception) {
return $arguments[0];
}
}
throw new MatcherException(sprintf("Wrong argument provided in throw matcher.\n" . "Fully qualified classname or exception instance expected,\n" . "Got %s.", $this->presenter->presentValue($arguments[0])));
}