Esempio n. 1
0
 private function httpWork()
 {
     $RouteMatch = new RouteMatch(self::$routesFile);
     $parameters = $RouteMatch->work();
     $routeController = $parameters->getControllerAndMethod();
     $routeArguments = $parameters->getArguments();
     if (is_callable($routeController)) {
         $return = call_user_func_array($routeController, $routeArguments);
     } else {
         $calssPosition = "\\App\\Http\\Controllers\\" . $parameters->getController();
         $controllerInstance = call_user_func_array([$calssPosition, 'work'], [$parameters]);
         // middleware work
         $return = MiddlewareMatch::work($parameters);
         is_bool($return) && ($return = call_user_func_array([$controllerInstance, $parameters->getMethod()], $routeArguments));
     }
     $this->setResponseContent($return);
 }
Esempio n. 2
0
 public function middleware($middleware, array $options = [])
 {
     MiddlewareMatch::addMiddleware($middleware, $options);
 }