protected function _check($reference)
{
$isString = is_string($reference);
if ($isString) {
if (!class_exists($reference)) {
throw new InvalidArgumentException("Can't Spy the unexisting class `{$reference}`.");
}
$reflection = Inspector::inspect($reference);
} else {
$reflection = Inspector::inspect(get_class($reference));
}
if (!$reflection->isInternal()) {
return;
}
if (!$isString) {
throw new InvalidArgumentException("Can't Spy built-in PHP instances, create a test double using `Double::instance()`.");
}
}