Application infrastructure initializer.
Grabs the standart incoming request, wraps it with appropriate objects, and handles the request by passing those objects to the corresponding route.
Consider index.php example:
$app = new SiteApplication(new ChainedRouter); $app->run();
The best practise is to implement your own SiteApplication class by extending this one
Definition at line 35 of file SiteApplication.class.php.
Public Member Functions | |
| __construct (IRouter $router) | |
| getRouter () | |
| Gets the application router. | |
| getWebContext () | |
| Gets the WebContext. | |
| run () | |
| Runs the application. | |
Protected Member Functions | |
| handle404 (Trace $trace) | |
| Handles the situation when the application failed to found the corresponding route. | |
| handle500 (Exception $e, Trace $trace=null) | |
| The failover stub. | |
| notify500 ($email, Exception $e) | |
| Notify about the fault. | |
| SiteApplication::__construct | ( | IRouter $ | router | ) |
| IRouter | router to use when handling the request. See ChainedRouter as basic impl. |
Definition at line 50 of file SiteApplication.class.php.
| SiteApplication::getRouter | ( | ) |
Gets the application router.
Definition at line 79 of file SiteApplication.class.php.
| SiteApplication::getWebContext | ( | ) |
| SiteApplication::handle404 | ( | Trace $ | trace | ) | [protected] |
Handles the situation when the application failed to found the corresponding route.
| Exception | in case of application fault |
| Trace | $trace trace failed to be handled |
Definition at line 116 of file SiteApplication.class.php.
References HttpStatus::CODE_404.
| SiteApplication::handle500 | ( | Exception $ | e, | |
| Trace $ | trace = null | |||
| ) | [protected] |
The failover stub.
Handles the application fault
| Exception | $e uncaught exception that caused fault | |
| Trace | $trace handled trace that caused an exception, if built. |
Definition at line 130 of file SiteApplication.class.php.
References HttpStatus::CODE_500, and notify500().
Referenced by run().
| SiteApplication::notify500 | ( | $ | email, | |
| Exception $ | e | |||
| ) | [protected] |
Notify about the fault.
| string | $email address to be notified about the fault | |
| Exception | $e uncaught exception that caused application fault |
Definition at line 160 of file SiteApplication.class.php.
Referenced by handle500().
| SiteApplication::run | ( | ) |
Runs the application.
Definition at line 89 of file SiteApplication.class.php.
References handle500().