public function registerClass(string $class, bool $useFullName = true) : self
{
if (!class_exists($class)) {
throw new \InvalidArgumentException(sprintf('Class %s does not exist.', $class));
}
$reflection = new \ReflectionClass($class);
foreach ($reflection->getMethods() as $method) {
// Only public methods
if ($method->isPublic()) {
$func = $class . '::' . $method->getName();
// Save short name as an alias
if (!$useFullName) {
$this->aliases[$method->getName()] = $func;
$func = $method->getName();
}
$this->register($func);
}
}
return $this;
}