/**
* Creates the application.
*
* @param \Webmozart\Console\Api\Application\Application $application
*/
public function __construct(\Webmozart\Console\Api\Application\Application $application)
{
$this->adaptedApplication = $application;
$config = $application->getConfig();
parent::__construct($config->getDisplayName(), $config->getVersion());
if ($dispatcher = $config->getEventDispatcher()) {
$this->setDispatcher($dispatcher);
}
$this->setAutoExit($config->isTerminatedAfterRun());
$this->setCatchExceptions($config->isExceptionCaught());
foreach ($application->getCommands() as $command) {
$this->add(new CommandAdapter($command, $this));
}
}