/** * Execute this command. * * @return mixed Executed result or exit code. * * @since 1.0 */ public function execute() { if (count($this->input->args) && $this->input->args[0] != 'help' && $this->getOption('h') && !$this->getParent()) { array_unshift($this->input->args, 'help'); } if ($this->getOption('no-ansi')) { $this->output->getProcessor()->noColors = true; } return parent::execute(); }
/** * @see \Sdc\AppBundle\Command\Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $start = new \DateTime(); $this->writeLn(sprintf(" Start at %s", $start->format('Y-m-d H:i:s'))); $this->initGeneratorOptions(); if ($this->canExecute() === true) { $this->initGenerator()->getGenerator()->generatePackage(); } elseif ($this->canExecute() === false) { $this->writeLn(" Generation not launched, use \"--force\" option to force generation"); $this->writeLn(sprintf(" Generator's option file used: %s", $this->resolveGeneratorOptionsConfigPath())); $this->writeLn(" Used generator's options:"); $this->writeLn(" " . implode(PHP_EOL . ' ', $this->formatArrayForConsole($this->generatorOptions->toArray()))); } $end = new \DateTime(); $this->writeLn(sprintf(" End at %s, duration: %s", $end->format('Y-m-d H:i:s'), $start->diff($end)->format('%H:%I:%S'))); }