public function terminate()
    {
        /** @var EventHandler $eventHandler */
        $eventHandler = $this->getService('event-handler');

        $eventHandler->getEvent(TerminateApplication::class)->attach(new LogBeforeTerminate());
        $eventHandler->getEvent(TerminateApplication::class)->attach(new ExitApplication());

        $eventHandler->fire(TerminateApplication::class, ['app' => $this]);
    }