AppserverIo\Appserver\ServletEngine\RequestHandler::shutdown PHP Method

shutdown() public method

Does shutdown logic for request handler if something went wrong and produces a fatal error for example.
public shutdown ( ) : void
return void
    public function shutdown()
    {
        // create a local copy of the request/response
        $servletRequest = $this->servletRequest;
        $servletResponse = $this->servletResponse;
        // check if we had a fatal error that caused the shutdown
        if ($lastError = error_get_last()) {
            // add the fatal error
            $this->addError(ErrorUtil::singleton()->fromArray($lastError));
            // in case of fatal errors, we need to override request with perpared
            // instances because error handling needs application access
            $servletRequest = RequestHandler::$requestContext;
        }
        // handle the errors if necessary
        ErrorUtil::singleton()->handleErrors($this, $servletRequest, $servletResponse);
        // copy request/response back to the thread context
        $this->servletRequest = $servletRequest;
        $this->servletResponse = $servletResponse;
    }