/**
* @param Application $application
*/
public function registerCustomCommands(Application $application)
{
foreach ($this->getArray(array('commands', 'customCommands')) as $commandClass) {
$commandName = null;
if (is_array($commandClass)) {
// Support for key => value (name -> class)
$commandName = key($commandClass);
$commandClass = current($commandClass);
}
if (null === ($command = $this->newCommand($commandClass, $commandName))) {
$this->output->writeln(sprintf('<error>Can not add nonexistent command class "%s" as command to the application</error>', $commandClass, $commandName));
$this->debugWriteln('Please check the configuration files contain the correct class-name. If the ' . 'class-name is correct, check autoloader configurations.');
} else {
$this->debugWriteln(sprintf('<debug>Add command </debug> <info>%s</info> -> <comment>%s</comment>', $command->getName(), get_class($command)));
$application->add($command);
}
}
}