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