Ejemplo n.º 1
9
 protected function execute()
 {
     $pathinfo = pathinfo($this->server->getParam('SCRIPT_NAME'));
     $basePath = $pathinfo['dirname'];
     $router = new \AltoRouter();
     $router->setBasePath($basePath);
     $routes = $this->metadata->getMetadata('routes');
     foreach ($routes as $route) {
         $router->map($route['method'], $route['rule'], $route['target']);
     }
     $match = $router->match();
     if (!empty($match)) {
         $this->parameters = array_merge($match['target'], $match['params']);
     }
 }
Ejemplo n.º 2
0
 protected function includeModuleHandlers()
 {
     $moduleHandlers = $this->metadataDriver->getMetadata('moduleHandlers');
     foreach ($moduleHandlers as $name => $metadata) {
         $moduleHandler = $this->loadObject($metadata, $name);
         if (!empty($metadata['source'])) {
             $moduleHandler->setMetadata($this->metadataDriver->getMetadata($metadata['source']));
         }
         $this->application->attachModuleHandler($moduleHandler);
     }
 }
Ejemplo n.º 3
0
 public function call($context, $method = 'execute')
 {
     $className = get_class($context);
     $hooks = $this->metadata->getMetadata('hooks');
     if (empty($hooks[$className][$method])) {
         return;
     }
     $callHooks = $hooks[$className][$method];
     foreach ($callHooks as $hook) {
         $hookModule = $this->application->getModule($hook['module']);
         $hookModule->{$hook['method']}($context);
     }
 }