/** * Main executor method * * @return void */ public function run() { try { $input = $this->setupInput(); $input->process(); if ($input->getOption('help')->value === TRUE) { $this->showVersion(); $this->showUsage(); exit(CLI::RC_OK); } if ($input->getOption('version')->value === TRUE) { $this->showVersion(); exit(CLI::RC_OK); } $config = $this->configure($input); $this->factory->setConfig($config); if (!$config->isQuietMode()) { $this->showVersion(); } $rc = $this->factory->getApplication()->run(); exit($rc); } catch (\ezcConsoleException $e) { $this->showVersion(); echo $e->getMessage() . "\n\n"; $this->showUsage(); exit(CLI::RC_PARAM_ERROR); } catch (\Exception $e) { $this->showVersion(); fwrite(STDERR, "\nError while processing request:\n - " . $e->getMessage() . "\n"); exit(CLI::RC_EXEC_ERROR); } }
/** * Main executor method * * @return void */ public function run() { try { $this->preBootstrap(); $input = $this->setupInput(); $input->process(); if ($input->getOption('help')->value === TRUE) { $this->showVersion(); $this->showUsage(); exit(CLI::RC_OK); } if ($input->getOption('version')->value === TRUE) { $this->showVersion(); exit(CLI::RC_OK); } $config = $this->configure($input); $this->factory->setConfig($config); if (!$config->isQuietMode()) { $this->showVersion(); } $rc = $this->factory->getApplication()->run(); exit($rc); } catch (CLIEnvironmentException $e) { $this->showVersion(); fwrite(STDERR, 'Sorry, but your PHP environment is currently not able to run phpab due to'); fwrite(STDERR, "\nthe following issue(s):\n\n" . $e->getMessage() . "\n\n"); fwrite(STDERR, "Please adjust your PHP configuration and try again.\n\n"); exit(CLI::RC_EXEC_ERROR); } catch (\ezcConsoleException $e) { $this->showVersion(); echo $e->getMessage() . "\n\n"; $this->showUsage(); exit(CLI::RC_PARAM_ERROR); } catch (CollectorException $e) { switch ($e->getCode()) { case CollectorException::InFileRedeclarationFound: case CollectorException::RedeclarationFound: case CollectorException::ParseErrror: $message = $e->getMessage(); break; default: $message = "Unexpected error in collector process: " . $e->getMessage() . "\n\nPlease report this as a bug.\n\n"; } $this->showVersion(); fwrite(STDERR, $message . "\n\n"); exit(CLI::RC_EXEC_ERROR); } catch (\Exception $e) { $this->showVersion(); fwrite(STDERR, "\nError while processing request:\n - " . $e->getMessage() . "\n"); exit(CLI::RC_EXEC_ERROR); } }