Back to ConsoleApplication class

Method doExecute

protected int
doExecute
()
Method to run the application routines.
Returns
  • int The exit code for the application
Since
  • 4.0.0
-
  • \Throwable

Method doExecute - Source code

/**
 * Method to run the application routines.
 *
 * @return  integer  The exit code for the application
 *
 * @since   4.0.0
 * @throws  \Throwable
 */
protected function doExecute() : int
{
    $exitCode = parent::doExecute();
    $style = new SymfonyStyle($this->getConsoleInput(), $this->getConsoleOutput());
    $methodMap = [self::MSG_ALERT => 'error', self::MSG_CRITICAL => 'caution', self::MSG_DEBUG => 'comment', self::MSG_EMERGENCY => 'caution', self::MSG_ERROR => 'error', self::MSG_INFO => 'note', self::MSG_NOTICE => 'note', self::MSG_WARNING => 'warning'];
    // Output any enqueued messages before the app exits
    foreach ($this->getMessageQueue() as $type => $messages) {
        $method = $methodMap[$type] ?? 'comment';
        $style->{$method}($messages);
    }
    return $exitCode;
}