| @@ -59,6 +59,9 @@ discard block | ||
| 59 | 59 | } | 
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | + /** | |
| 63 | + * @param string $function_name | |
| 64 | + */ | |
| 62 | 65 |      private function returnJson($function_name, $request, $args, $response){ | 
| 63 | 66 | $status = 500; | 
| 64 | 67 | $function_output = call_user_func($function_name, $request, $args); | 
| @@ -74,6 +77,12 @@ discard block | ||
| 74 | 77 |          return $response->withHeader('Content-Type', 'application/json;charset=utf-8')->withHeader('X-Powered-By', "reformo/rslim")->withStatus($status); | 
| 75 | 78 | } | 
| 76 | 79 | |
| 80 | + /** | |
| 81 | + * @param string $function_name | |
| 82 | + * @param string $action | |
| 83 | + * @param string $controller | |
| 84 | + * @param string $template | |
| 85 | + */ | |
| 77 | 86 |      private function returnHtml($function_name, $request, $args, $response, $route, $action, $controller, $template){ | 
| 78 | 87 |          if (!file_exists($this->config['base_dir'] . $template)) { | 
| 79 | 88 |              throw new \Exception("<strong>Template file not found!</strong> " . $route . '/' . $action . " needs a template file at:" . $template); | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 |          if (file_exists($controller)) { | 
| 42 | 42 | require_once($controller); | 
| 43 | 43 | |
| 44 | - $function_name = $route.'_'.$action; | |
| 44 | + $function_name = $route . '_' . $action; | |
| 45 | 45 |              if (!function_exists($function_name)) { | 
| 46 | 46 | $return_type = 'html'; | 
| 47 | 47 | return $this->notFound($request, $response, $return_type, 'Controller ' . $route . '/' . $action . " has not " . $function_name . " function"); | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | } | 
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | -    private function returnJson($function_name, $request, $args, $response){ | |
| 62 | +    private function returnJson($function_name, $request, $args, $response) { | |
| 63 | 63 | $status = 500; | 
| 64 | 64 | $function_output = call_user_func($function_name, $request, $args); | 
| 65 | 65 |          if (!is_array($function_output)) { | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 |          return $response->withHeader('Content-Type', 'application/json;charset=utf-8')->withHeader('X-Powered-By', "reformo/rslim")->withStatus($status); | 
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | -    private function returnHtml($function_name, $request, $args, $response, $route, $action, $controller, $template){ | |
| 77 | +    private function returnHtml($function_name, $request, $args, $response, $route, $action, $controller, $template) { | |
| 78 | 78 |          if (!file_exists($this->config['base_dir'] . $template)) { | 
| 79 | 79 |              throw new \Exception("<strong>Template file not found!</strong> " . $route . '/' . $action . " needs a template file at:" . $template); | 
| 80 | 80 | } | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | $main_template = '/' . $this->config['app_dir'] . '/templates/_' . $main_template_name . '.html'; | 
| 92 | 92 | |
| 93 | 93 |          if (!file_exists($this->config['base_dir'] . $main_template)) { | 
| 94 | -            throw new \Exception("<strong>Main emplate file not found!</strong> ".$route . '/' . $action . | |
| 94 | +            throw new \Exception("<strong>Main emplate file not found!</strong> " . $route . '/' . $action . | |
| 95 | 95 | " needs a main template file at:" . $main_template); | 
| 96 | 96 | } | 
| 97 | 97 | $app_content = $this->twig->render($main_template, $function_output); |