Nette\Application\Application::run PHP Method

run() public method

Dispatch a HTTP request to a front controller.
public run ( ) : void
return void
    public function run()
    {
        try {
            $this->onStartup($this);
            $this->processRequest($this->createInitialRequest());
            $this->onShutdown($this);
        } catch (\Throwable $e) {
        } catch (\Exception $e) {
        }
        if (isset($e)) {
            $this->onError($this, $e);
            if ($this->catchExceptions && $this->errorPresenter) {
                try {
                    $this->processException($e);
                    $this->onShutdown($this, $e);
                    return;
                } catch (\Throwable $e) {
                    $this->onError($this, $e);
                } catch (\Exception $e) {
                    $this->onError($this, $e);
                }
            }
            $this->onShutdown($this, $e);
            throw $e;
        }
    }

Usage Example

Example #1
0
	public function run()
	{
		if (PHP_SAPI == "cli") {
			$this->context->console->run();
		} else {
			parent::run();
		}
	}