/** * Execute the action, triggers the events and then exit the program. */ protected function run() { $this->silentRunActionTrigger(Action::EVENT_START); try { $event = $this->action->execute($this->control, $this->context) ?: Action::EVENT_SUCCESS; $this->context->exitCode = 0; } catch (ErrorException $errorException) { $event = Action::EVENT_ERROR; $this->context->exception = $errorException; $this->context->exitCode = 2; } catch (Exception $exception) { $event = Action::EVENT_FAILURE; $this->context->exception = $exception; $this->context->exitCode = 1; } $this->context->finishTime = time(); $this->silentRunActionTrigger($event); $this->silentRunActionTrigger(Action::EVENT_FINISH); }