Example #1
0
 protected function handleString($route)
 {
     Registry::set('application.controller.path', $this->resolveController($route));
     Events::create(array('title' => 'application.route', 'event' => function () {
         $action = Registry::get('application.controller.path');
         $route = new $action['controller']();
         $route->{$action}['method']();
     }));
 }
Example #2
0
 * Setting up the events manager
 */
Registry::set('foundation.events', new Events());
Events::create(array('title' => 'application.boot', 'event' => function () {
}));
/**
 * Setting the current HTTP request to the events manager
 */
Events::create(array('title' => 'request.get', 'event' => function () {
    return SymfonyRequest::createFromGlobals();
}));
/**
 * Setting up the default error page
 */
Events::create(array('title' => 'application.error.404', 'event' => function () {
    return '<h2>Er is een fout opgetreden!</h2><p>De pagina waarop je gezocht op hebt, is helaas niet (meer) beschrikaar';
}));
/**
 * Creating all aliases for the original classes, they are specified in the config array
 */
foreach (Registry::get('config')['classAliases'] as $originalClass => $alias) {
    AliasLoader::create($originalClass, $alias);
}
/**
 * Attach all of the service providers (specified the config file) to the application
 */
foreach (Registry::get('config')['serviceProviders'] as $serviceProvider) {
    $app->register(new $serviceProvider());
}
require APP . 'routes.php';
/**
Example #3
0
 public function triggerErrorPage($error)
 {
     return Events::trigger('application.error.' . $error);
 }
Example #4
0
 public function register()
 {
     $this->request = Events::trigger('request.get');
 }