src/main/php/WebApp.php
public function run(): SendableResponse
    {
        $request  = WebRequest::fromRawSource();
        $response = new WebResponse($request);
        if ($response->isFixed()) {
            return $response; // http version of request not supported
        }

        try {
            $requestUri = $request->uri();
        } catch (MalformedUri $mue) {
            $response->status()->badRequest();
            return $response;
        }

        $this->configureRouting($this->routing);
        $uriResource = $this->routing->findResource($requestUri, $request->method());
        if ($this->switchToHttps($request, $uriResource)) {
            $response->redirect($uriResource->httpsUri());
            return $response;
        }

        try {
            if (!$uriResource->negotiateMimeType($request, $response)) {
                return $response;
            }

            $this->sessionHandshake($request, $response);
            if ($uriResource->applyPreInterceptors($request, $response)) {
                $response->write($uriResource->resolve($request, $response));
                $uriResource->applyPostInterceptors($request, $response);
            }
        } catch (\Exception $e) {
            $this->injector->getInstance(ExceptionLogger::class)->log($e);
            $response->write($response->internalServerError($e->getMessage()));
        }

        return $response;
    }
public function run(): SendableResponse
    {
        $request  = WebRequest::fromRawSource();
        $response = new WebResponse($request);
        if ($response->isFixed()) {
            return $response; // http version of request not supported
        }

        try {
            $requestUri = $request->uri();
        } catch (MalformedUri $mue) {
            $response->status()->badRequest();
            return $response;
        }

        $this->configureRouting($this->routing);
        $uriResource = $this->routing->findResource($requestUri, $request->method());
        if ($this->switchToHttps($request, $uriResource)) {
            $response->redirect($uriResource->httpsUri());
            return $response;
        }

        try {
            if (!$uriResource->negotiateMimeType($request, $response)) {
                return $response;
            }

            $this->sessionHandshake($request, $response);
            if ($uriResource->applyPreInterceptors($request, $response)) {
                $response->write($uriResource->resolve($request, $response));
                $uriResource->applyPostInterceptors($request, $response);
            }
        } catch (\Exception $e) {
            $this->injector->getInstance(ExceptionLogger::class)->log($e);
            $response->write($response->internalServerError($e->getMessage()));
        }

        return $response;
    }
public function run ( ) : SendableResponse { $ request = WebRequest :: fromRawSource ( ) ; $ response = new WebResponse ( $ request ) ; if ( $ response -> isFixed ( ) ) { return $ response ; // http version of request not supported } try { $ requestUri = $ request -> uri ( ) ; } catch ( MalformedUri $ mue ) { $ response -> status ( ) -> badRequest ( ) ; return $ response ; } $ this -> configureRouting ( $ this -> routing ) ; $ uriResource = $ this -> routing -> findResource ( $ requestUri , $ request -> method ( ) ) ; if ( $ this -> switchToHttps ( $ request , $ uriResource ) ) { $ response -> redirect ( $ uriResource -> httpsUri ( ) ) ; return $ response ; } try { if ( ! $ uriResource -> negotiateMimeType ( $ request , $ response ) ) { return $ response ; } $ this -> sessionHandshake ( $ request , $ response ) ; if ( $ uriResource -> applyPreInterceptors ( $ request , $ response ) ) { $ response -> write ( $ uriResource -> resolve ( $ request , $ response ) ) ; $ uriResource -> applyPostInterceptors ( $ request , $ response ) ; } } catch ( \ Exception $ e ) { $ this -> injector -> getInstance ( ExceptionLogger :: class ) -> log ( $ e ) ; $ response -> write ( $ response -> internalServerError ( $ e -> getMessage ( ) ) ) ; } return $ response ; }
runs the application but does not send the response

@return  \stubbles\webapp\response\SendableResponse
runs the application but does not send the response