getCommands() public method

Returns all registered commands.
public getCommands ( ) : CommandCollection
return Webmozart\Console\Api\Command\CommandCollection The commands.
Example #1
0
 /**
  * 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));
     }
 }