@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (file_exists($controller)) { |
41 | 41 | require_once($controller); |
42 | 42 | |
43 | - $function_name = $route.'_'.$action; |
|
43 | + $function_name = $route . '_' . $action; |
|
44 | 44 | if (!function_exists($function_name)) { |
45 | 45 | $return_type = 'html'; |
46 | 46 | return $this->notFound($request, $response, $return_type, 'Controller ' . $route . '/' . $action . " has not " . $function_name . " function"); |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | $this->app->run(); |
96 | 96 | } |
97 | 97 | |
98 | - private function returnJson($function_name, $request, $args, $response){ |
|
98 | + private function returnJson($function_name, $request, $args, $response) { |
|
99 | 99 | $function_output = call_user_func($function_name, $request, $args); |
100 | - if(isset($function_output['redirect'])){ |
|
100 | + if (isset($function_output['redirect'])) { |
|
101 | 101 | return $response->withRedirect($function_output['redirect']); |
102 | 102 | } |
103 | 103 | if (!is_array($function_output)) { |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | return $response->withHeader('Content-Type', 'application/json;charset=utf-8')->withHeader('X-Powered-By', "reformo/rslim")->withStatus($status); |
111 | 111 | } |
112 | 112 | |
113 | - private function returnHtml($function_name, $request, $args, $response, $route, $action, $template){ |
|
113 | + private function returnHtml($function_name, $request, $args, $response, $route, $action, $template) { |
|
114 | 114 | if (!file_exists($this->config['base_dir'] . $template)) { |
115 | 115 | throw new \Exception("<strong>Template file not found!</strong> " . $route . '/' . $action . " needs a template file at:" . $template); |
116 | 116 | } |
117 | 117 | $function_output = call_user_func($function_name, $request, $args); |
118 | - if(isset($function_output['redirect'])){ |
|
118 | + if (isset($function_output['redirect'])) { |
|
119 | 119 | return $response->withRedirect($function_output['redirect']); |
120 | 120 | } |
121 | 121 | if (!isset($function_output['data'])) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $main_template = '/' . $this->config['app_dir'] . '/templates/_' . $main_template_name . '.html'; |
131 | 131 | |
132 | 132 | if (!file_exists($this->config['base_dir'] . $main_template)) { |
133 | - throw new \Exception("<strong>Main emplate file not found!</strong> ".$route . '/' . $action . |
|
133 | + throw new \Exception("<strong>Main emplate file not found!</strong> " . $route . '/' . $action . |
|
134 | 134 | " needs a main template file at:" . $main_template); |
135 | 135 | } |
136 | 136 | $app_content = $this->twig->render($main_template, $function_output); |