public function __construct()
{
$system = $this;
//set up the event handler
set_error_handler(function ($severity, $message, $filePath, $line) use(&$system) {
$error = new Error($severity, $message, $filePath, $line);
$system->emit("system.error", $error);
});
//set up exception handler
set_exception_handler(function ($exception) use(&$system) {
$system->emit("system.exception", $exception);
});
//on shutdown, run the event loop
register_shutdown_function(function () {
uv_run();
});
// start the event loop
$this->eventLoop = uv_default_loop();
//set up the core module map
$modulePrefix = "\\Phastlight\\Module\\";
$this->moduleMap = array('console' => $modulePrefix . 'Console\\Main', 'process' => $modulePrefix . 'Process\\Main', 'os' => $modulePrefix . 'OS\\Main', 'http' => $modulePrefix . 'HTTP\\Main', 'timer' => $modulePrefix . 'Timer\\Main', 'util' => $modulePrefix . 'Util\\Main', 'fs' => $modulePrefix . 'FileSystem\\Main', 'net' => $modulePrefix . 'NET\\Main', 'child_process' => $modulePrefix . 'ChildProcess\\Main', 'cluster' => $modulePrefix . 'Cluster\\Main');
$this->modules = array();
}