@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | $function_output = app_content($request, $args); |
| 48 | 48 | if(!is_array( $function_output) ){ |
| 49 | 49 | $function_output = ["status" => 500, "error" => "Internal Server Error"]; |
| 50 | - } |
|
| 51 | - else{ |
|
| 50 | + } else{ |
|
| 52 | 51 | if(!isset($function_output['status'])){ |
| 53 | 52 | $function_output['status']=200; |
| 54 | 53 | } |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | } |
| 57 | 56 | $response->getBody()->write( json_encode( $function_output ) ); |
| 58 | 57 | $newResponse = $response->withHeader('Content-Type', 'application/json;charset=utf-8')->withHeader('X-Powered-By',"reformo/rslim")->withStatus($status); |
| 59 | - } |
|
| 60 | - else{ |
|
| 58 | + } else{ |
|
| 61 | 59 | if(!file_exists($this->config['base_dir'].$template)){ |
| 62 | 60 | throw new \Exception("<strong>Template file not found!</strong> ".$route.'/'.$action." needs a template file at:".$template ); |
| 63 | 61 | } |
@@ -87,8 +85,7 @@ discard block |
||
| 87 | 85 | $newResponse->write($app_content); |
| 88 | 86 | } |
| 89 | 87 | return $newResponse; |
| 90 | - } |
|
| 91 | - else{ |
|
| 88 | + } else{ |
|
| 92 | 89 | return $this->not_found($request, $response, $return_type, 'Controller '. $route . '/' . $action." not found"); |
| 93 | 90 | } |
| 94 | 91 | } |
@@ -99,8 +96,7 @@ discard block |
||
| 99 | 96 | if($return_type == 'json'){ |
| 100 | 97 | $response->getBody()->write( json_encode( ['status'=>404, 'message'=>$message] ) ); |
| 101 | 98 | return $response->withHeader('Content-Type', 'application/json;charset=utf-8')->withHeader('X-Powered-By',"reformo/rslim")->withStatus(404); |
| 102 | - } |
|
| 103 | - else{ |
|
| 99 | + } else{ |
|
| 104 | 100 | return $response->withStatus(404) |
| 105 | 101 | ->withHeader('Content-Type', 'text/html')->withHeader('X-Powered-By',"reformo/rslim") |
| 106 | 102 | ->write($this->twig->render($not_found_template, ['message'=>$message])); |