PHP Finden Sie alle Unterklassen der Klasse
/* Loops through all loaded classes (get_declared_classes()) and
returns an array of subclasses of the provided $parent */
function getSubclasses(string $parent):array {
return array_reduce(get_declared_classes(), function($subclasses, $class) use ($parent) {
if (is_subclass_of($class, $parent)) {
$subclasses[] = $class;
}
return $subclasses;
}, []);
}
P. Tune