Skip to content

Instantly share code, notes, and snippets.

@harikt
Forked from anonymous/reflect.php
Created January 16, 2013 14:50
Show Gist options
  • Save harikt/4547632 to your computer and use it in GitHub Desktop.
Save harikt/4547632 to your computer and use it in GitHub Desktop.
// Require the file
$class = "ClassName";
$r = new ReflectionClass($class);
$str = '';
foreach($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
$rm = new ReflectionMethod($class, $method->name);
$pieces = array();
foreach($rm->getParameters() as $params ) {
$pieces[] = $params->name;
}
$str .= lcfirst($method->name) . '(' . implode(',', $pieces) . ')' . PHP_EOL;
}
file_put_contents('classes.txt', $str);
// You will get output in classes.txt . This only takes public methods..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment