function hasPublicConstructor($class) {
try {
$m = new ReflectionMethod($class, $class);
if ($m->isPublic()) {
return true;
}
}
catch (ReflectionException $e) {
}
try {
$m = new ReflectionMethod($class,'__construct');
if ($m->isPublic()) {
return true;
}
}
catch (ReflectionException $e) {
}
return false;
}