-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDispatch.php
More file actions
35 lines (27 loc) · 1.06 KB
/
Dispatch.php
File metadata and controls
35 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once "framework/DispatchRouteRegistry.php";
require_once "framework/DispatchUrlBuilder.php";
require_once "framework/DispatchViewManager.php";
require_once "framework/DispatchApplication.php";
class Dispatch {
function __construct($config) {
$routeRegistry = new DispatchRouteRegistry($config["routes"]);
$urlBuilder = new DispatchUrlBuilder($config["baseUrl"], $routeRegistry);
/* The views here need information about the routes and events
* to insert the correct URLs into the page */
$viewManager = new DispatchViewManager($urlBuilder, $config["views"]);
/* The handlers here need to know about the views to display
* the correct one */
$this->application = new DispatchApplication($urlBuilder, $routeRegistry, $viewManager, array(
"baseUrl" => $config["baseUrl"],
"defaultEvent" => $config["defaultEvent"],
"exceptionEvent" => $config["exceptionEvent"],
"handlers" => $config["handlers"],
"plugins" => $config["plugins"],
"events" => $config["events"]
));
}
function run() {
$this->application->run();
}
}