public function register($fallbackPrefix, Command $command, $label = null, $overrideConfig = false)
{
if ($label === null) {
$label = $command->getName();
}
$label = strtolower(trim($label));
//Check if command was disabled in config and for override
if (!($this->commandConfig[$label] ?? $this->commandConfig["default"] ?? true or $overrideConfig)) {
return false;
}
$fallbackPrefix = strtolower(trim($fallbackPrefix));
$registered = $this->registerAlias($command, false, $fallbackPrefix, $label);
$aliases = $command->getAliases();
foreach ($aliases as $index => $alias) {
if (!$this->registerAlias($command, true, $fallbackPrefix, $alias)) {
unset($aliases[$index]);
}
}
$command->setAliases($aliases);
if (!$registered) {
$command->setLabel($fallbackPrefix . ":" . $label);
}
$command->register($this);
return $registered;
}