PPI\Framework\App::run PHP Method

run() public method

Run the application and send the response.
public run ( PPI\Framework\Http\Request $request = null, PPI\Framework\Http\Response $response = null ) : PPI\Framework\Http\Response
$request PPI\Framework\Http\Request
$response PPI\Framework\Http\Response
return PPI\Framework\Http\Response
    public function run(HttpRequest $request = null, HttpResponse $response = null)
    {
        if (false === $this->booted) {
            $this->boot();
        }
        if (null === $request) {
            $request = HttpRequest::createFromGlobals();
        }
        if (null === $response) {
            $response = new HttpResponse();
        }
        // Create a copy of request, as it's by-ref passed into $this->dispatch() and gets modified.
        $cleanRequest = clone $request;
        try {
            $response = $this->dispatch($request, $response);
        } catch (ResourceNotFoundException $e) {
            if ($this->symfonyKernel === null) {
                throw $e;
            }
            $response = $this->symfonyKernel->handle($cleanRequest);
        }
        $response->send();
        return $response;
    }