*/ private array $commandMap = []; /** * Set the available commands. * * @param Command[] $commands */ public function setCommands(array $commands): void { $this->commandMap = []; foreach ($commands as $command) { $this->commandMap[$command->getName()] = $command; foreach ($command->getAliases() as $alias) { $this->commandMap[$alias] = $command; } } } }