Skip to content

Instantly share code, notes, and snippets.

@wgm89
Created March 20, 2015 03:42
Show Gist options
  • Select an option

  • Save wgm89/1276d577c4bea531c970 to your computer and use it in GitHub Desktop.

Select an option

Save wgm89/1276d577c4bea531c970 to your computer and use it in GitHub Desktop.
Extension Reflection
<?php
$e = new ReflectionExtension('gearman');
print "<?php\n\n// Gearman Version: " . $e->getVersion() . "\n\n";
foreach ($e->getClasses() as $c) {
print 'class ' . $c->name . " {\n";
foreach ($c->getMethods() as $m) {
print ' ';
if ($m->isPublic()) {
print 'public';
} elseif ($m->isProtected()) {
print 'protected';
} elseif ($m->isPrivate()) {
print 'private';
}
print ' function ' . $m->name . '(';
$sep = '';
foreach ($m->getParameters() as $p) {
print $sep;
$sep = ', ';
if ($p->isOptional())
print '$' . $p->name . ' = null' ;
else
print '$' . $p->name;
}
print "){}\n";
}
print "}\n\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment