Exemplo n.º 1
0
Arquivo: Router.php Projeto: wyv/wyv
 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);
         }
     }
 }
Exemplo n.º 2
0
Arquivo: Routes.php Projeto: wyv/wyv
 public function ref($path, $moduleName)
 {
     $moduleRoutes = Module::get($this->module->getModuleDir() . '/wyv_modules/' . $moduleName)->routes();
     foreach ($moduleRoutes as $i => $route) {
         $route['path'] = $path . $route['path'];
         $this->routes[] = $route;
     }
 }
Exemplo n.º 3
0
 protected function ref($name)
 {
     return Module::get($this->module->getModuleDir() . '/wyv_modules/' . $name);
 }
Exemplo n.º 4
0
Arquivo: WebApp.php Projeto: wyv/wyv
 public function __construct($moduleDir, $env = 'development')
 {
     $this->wyv = Wyv::getInstance($env);
     $this->appModule = Module::get($moduleDir);
 }