Example #1
0
 /**
  * @param Route $route
  */
 private function process(Route $route, Request $request)
 {
     $this->dispatch('process.before', [$request]);
     $arguments = $route->getArguments();
     array_unshift($arguments, $request);
     try {
         $response = call_user_func_array($route->getCallable(), $arguments);
         if (!$response instanceof Response) {
             $response = new Response($response);
         }
         $response->send();
     } catch (HttpException $e) {
         throw $e;
     } catch (\Exception $e) {
         throw new HttpException(500, null, $e);
     }
 }
Example #2
0
 /**
  * @param Route $route
  */
 private function process(Route $route, Request $request)
 {
     $arguments = $route->getArguments();
     array_unshift($arguments, $request);
     try {
         $contentResponse = call_user_func_array($route->getCallable(), $arguments);
         //~ http_response_code($this->statusCode);
         //~ echo $response;
         $response = new Response($contentResponse, $this->statusCode);
         $response->send();
     } catch (HttpException $e) {
         throw $e;
     } catch (\Exception $e) {
         throw new HttpException(500, null, $e);
     }
 }