public function run(?ServerRequestInterface $request = null, bool $returnResponse = false)
    {
        $request = (null !== $request) ? $request : ServerRequest::fromGlobals();
        $request = $request->withAttribute('originalResponse', $this->response);
        $response = $this->dispatcher->handle($request);

        $this->log(
            $this->container,
            sprintf(
                'App::run - Response [%d] %s',
                $response->getStatusCode(),
                $response->getReasonPhrase()
            )
        );

        if (true === $returnResponse) {
            return $response;
        }

        if (PHP_SAPI === 'cli') {
            echo (string) $response->getBody();
        } else {
            \Http\Response\send($response);
        }
    }
public function run(?ServerRequestInterface $request = null, bool $returnResponse = false)
    {
        $request = (null !== $request) ? $request : ServerRequest::fromGlobals();
        $request = $request->withAttribute('originalResponse', $this->response);
        $response = $this->dispatcher->handle($request);

        $this->log(
            $this->container,
            sprintf(
                'App::run - Response [%d] %s',
                $response->getStatusCode(),
                $response->getReasonPhrase()
            )
        );

        if (true === $returnResponse) {
            return $response;
        }

        if (PHP_SAPI === 'cli') {
            echo (string) $response->getBody();
        } else {
            \Http\Response\send($response);
        }
    }
public function run ( ? ServerRequestInterface $ request = null , bool $ returnResponse = false ) { $ request = ( null !== $ request ) ? $ request : ServerRequest :: fromGlobals ( ) ; $ request = $ request -> withAttribute ( 'originalResponse' , $ this -> response ) ; $ response = $ this -> dispatcher -> handle ( $ request ) ; $ this -> log ( $ this -> container , sprintf ( 'App::run - Response [%d] %s' , $ response -> getStatusCode ( ) , $ response -> getReasonPhrase ( ) ) ) ; if ( true === $ returnResponse ) { return $ response ; } if ( PHP_SAPI === 'cli' ) { echo ( string ) $ response -> getBody ( ) ; } else { \ Http \ Response \ send ( $ response ) ; } }
Start process dispatcher.

@param null|ServerRequestInterface $request
@param bool                        $returnResponse

@return void|\Psr\Http\Message\ResponseInterface
Start process dispatcher .