/** * Creates a console application with all of the commands attached. * @return ConsoleApplication */ public function __construct() { parent::__construct("ImagickDemos", "1.0.0"); $statsCommand = new Command('statsRunner', 'Stats\\SimpleStats::run'); $statsCommand->setDescription("Run the stats collector and send the results to Librato."); $this->add($statsCommand); $taskCommand = new Command('imageRunner', 'ImagickDemo\\Queue\\ImagickTaskRunner::run'); $taskCommand->setDescription("Pull image request jobs off the queue and generated the images."); $this->add($taskCommand); $clearCacheCommand = new Command('clearCache', 'ImagickDemo\\Config\\APCCacheEnvReader::clearCache'); $clearCacheCommand->setDescription("Clear the apc cache."); $this->add($clearCacheCommand); $envWriteCommand = new Command('genEnvSettings', 'ImagickDemo\\Config\\EnvConfWriter::writeEnvFile'); $envWriteCommand->setDescription("Write an env setting bash script."); $envWriteCommand->addArgument('env', InputArgument::REQUIRED, 'Which environment the settings should be generated for.'); $envWriteCommand->addArgument('filename', InputArgument::REQUIRED, 'The file name that the env settings should be written to.'); $this->add($envWriteCommand); $clearRedisCommand = new Command('clearRedis', 'ImagickDemo\\Queue\\ImagickTaskQueue::clearStatusQueue'); $clearRedisCommand->setDescription("Clear the imagick task queue."); $this->add($clearRedisCommand); }
public function __construct() { parent::__construct('My Symfony application', 'v1.0'); $this->add(new DescriptorCommand1()); $this->add(new DescriptorCommand2()); }
/** * Overwrites the constructor in order to set a different default command. */ public function __construct() { parent::__construct(); $command = new \FooCommand(); $this->add($command); $this->setDefaultCommand($command->getName()); }
public function __construct($defaultCommand, $name = 'UNKNOWN', $version = 'UNKNOWN') { $this->defaultCommand = $defaultCommand; parent::__construct($name, $version); }