src/Application/HttpApplication.php
public function run(HttpServer $server = null): void
    {
        $this->startup();
        if ($server) {
            $server->addListener($this);
            $server->start();
        } else {
            $response = $this->handle(ServerRequest::fromGlobals());
            $this->emitter->emit($response);
            if ($response instanceof Response) {
                $response->end();
            }
        }

        $this->shutdown();
    }
public function run(HttpServer $server = null): void
    {
        $this->startup();
        if ($server) {
            $server->addListener($this);
            $server->start();
        } else {
            $response = $this->handle(ServerRequest::fromGlobals());
            $this->emitter->emit($response);
            if ($response instanceof Response) {
                $response->end();
            }
        }

        $this->shutdown();
    }
Startups and run application with/or without dedicated server.
Once application is run it will listen to incoming http requests,
and takes care of the entire request flow process.

@param HttpServer|null $server