I had to fix someone else's php4 code to work under php5 that was b0rked due to aggregate not working, here's how I did it.
<?php
class shell { }
$classes = array("foo", "bar", "baz");
function php5aggregate($holdingClass, $className)
{
$reflect = new ReflectionClass($className);
foreach ($reflect->getMethods() as $method)
{
runkit_method_copy($holdingClass, $method->getName(), $className);
}
}
if (version_compare(PHP_VERSION, '5.0.0') === 1)
{
foreach($classes as $value)
{
php5aggregate("shell",$value);
}
$shell = new shell;
}
else
{
$shell = new shell;
foreach($classes as $value)
{
aggregate($shell,$value);
}
}
?>