public function route() { $matchingRoutes = $this->matchRoutes(); $next = function ($v = Router::ROUTE_NEXT_FORCED) { static $val = Router::ROUTE_NEXT_EMPTY; if ($v !== Router::ROUTE_NEXT_EMPTY) { if ($v === Router::ROUTE_NEXT_RESET) { $val = Router::ROUTE_NEXT_EMPTY; } else { $val = $v; } } return $val; }; $routeParams = null; foreach ($matchingRoutes as $route) { $module = Module::get($this->appModule->getModuleDir() . $route['moduleDir']); $RouteClass = Loader::load($this->appModule->getModuleDir() . $route['routeFilePath'], $route['routeClass'], $module->getModuleId()); $routeMethod = $route['routeMethod']; $RouteClass::getInstance($module)->{$routeMethod}($this->request, Response::getInstance(), $next, $routeParams); $routeParams = $next(self::ROUTE_NEXT_EMPTY); if ($routeParams === self::ROUTE_NEXT_EMPTY) { break; } else { $next(self::ROUTE_NEXT_RESET); } } }
private function getLibClass($name) { return Loader::load($this->moduleDir . '/Libraries/' . $name . '.php', $name, $this->moduleId); }