function need_params($func) {
$reflection = new ReflectionFunction($func);
return $reflection->getNumberOfParameters();
}
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;
}