|  | @@ 96-119 (lines=24) @@ | 
                                                            
                                    | 93 |  |         $this->data = $functionOutput; | 
                                                            
                                    | 94 |  |     } | 
                                                            
                                    | 95 |  |  | 
                                                            
                                    | 96 |  |     public function returnHtml(array $functionOutput, string $controllerClass) : void | 
                                                            
                                    | 97 |  |     { | 
                                                            
                                    | 98 |  |         $this->useSession(); | 
                                                            
                                    | 99 |  |         $this->useView($this->container->get(ViewInterface::class)); | 
                                                            
                                    | 100 |  |         $paths = explode("\\", $controllerClass); | 
                                                            
                                    | 101 |  |         $templateFile = array_pop($paths); | 
                                                            
                                    | 102 |  |         $templateFolder = array_pop($paths); | 
                                                            
                                    | 103 |  |         $template = strtolower($templateFolder) . '/' . strtolower($templateFile) . '.twig'; | 
                                                            
                                    | 104 |  |  | 
                                                            
                                    | 105 |  |         if (isset($functionOutput['redirect'])) { | 
                                                            
                                    | 106 |  |             $this->contentType   = 'redirect'; | 
                                                            
                                    | 107 |  |             $this->statusCode       = 301; | 
                                                            
                                    | 108 |  |             $this->redirect     = $functionOutput['redirect']; | 
                                                            
                                    | 109 |  |         } | 
                                                            
                                    | 110 |  |         $this->view->addGlobal('defined', get_defined_constants(true)['user'] ?? []); | 
                                                            
                                    | 111 |  |         $this->view->addGlobal('session', $this->session->all()); | 
                                                            
                                    | 112 |  |         $this->checkTemplateFile($template, 'Method\'s', $controllerClass); | 
                                                            
                                    | 113 |  |         $functionOutput['data'] = $functionOutput['data'] ?? []; | 
                                                            
                                    | 114 |  |         $functionOutput['app_content'] = $this->view->render($template, $functionOutput['data']); | 
                                                            
                                    | 115 |  |         $mainTemplateName = $functionOutput['app_main_template'] ?? 'default'; | 
                                                            
                                    | 116 |  |         $mainTemplate = '_' . strtolower($mainTemplateName) . '.twig'; | 
                                                            
                                    | 117 |  |         $this->checkTemplateFile($mainTemplate, 'Main', $controllerClass); | 
                                                            
                                    | 118 |  |         $this->body = $this->view->render($mainTemplate, $functionOutput); | 
                                                            
                                    | 119 |  |     } | 
                                                            
                                    | 120 |  |  | 
                                                            
                                    | 121 |  |  | 
                                                            
                                    | 122 |  |     public function returnText(array $functionOutput, string $controllerClass) : void | 
                                                                                
                                |  | @@ 122-145 (lines=24) @@ | 
                                                            
                                    | 119 |  |     } | 
                                                            
                                    | 120 |  |  | 
                                                            
                                    | 121 |  |  | 
                                                            
                                    | 122 |  |     public function returnText(array $functionOutput, string $controllerClass) : void | 
                                                            
                                    | 123 |  |     { | 
                                                            
                                    | 124 |  |         $this->useSession(); | 
                                                            
                                    | 125 |  |         $this->useView($this->container->get(ViewInterface::class)); | 
                                                            
                                    | 126 |  |         $paths = explode("\\", $controllerClass); | 
                                                            
                                    | 127 |  |         $templateFile = array_pop($paths); | 
                                                            
                                    | 128 |  |         $templateFolder = array_pop($paths); | 
                                                            
                                    | 129 |  |         $template = strtolower($templateFolder) . '/' . strtolower($templateFile) . '.twig'; | 
                                                            
                                    | 130 |  |         if (isset($functionOutput['redirect'])) { | 
                                                            
                                    | 131 |  |             $this->contentType   = 'redirect'; | 
                                                            
                                    | 132 |  |             $this->statusCode       = 301; | 
                                                            
                                    | 133 |  |             $this->redirect     = $functionOutput['redirect']; | 
                                                            
                                    | 134 |  |         } | 
                                                            
                                    | 135 |  |         $this->view->addGlobal('defined', get_defined_constants(true)['user'] ?? []); | 
                                                            
                                    | 136 |  |         $this->view->addGlobal('session', $this->session->all()); | 
                                                            
                                    | 137 |  |         $this->checkTemplateFile($template, 'Method\'s', $controllerClass); | 
                                                            
                                    | 138 |  |         $functionOutput['data'] = $functionOutput['data'] ?? []; | 
                                                            
                                    | 139 |  |         $functionOutput['app_content'] = $this->view->render($template, $functionOutput['data']); | 
                                                            
                                    | 140 |  |         $mainTemplateName = $functionOutput['layout'] ?? 'default'; | 
                                                            
                                    | 141 |  |         $mainTemplate = '_' . strtolower($mainTemplateName) . '.twig'; | 
                                                            
                                    | 142 |  |         $this->checkTemplateFile($mainTemplate, 'Main', $controllerClass); | 
                                                            
                                    | 143 |  |         $this->contentType = 'text'; | 
                                                            
                                    | 144 |  |         $this->body = $this->view->render($mainTemplate, $functionOutput); | 
                                                            
                                    | 145 |  |     } | 
                                                            
                                    | 146 |  |  | 
                                                            
                                    | 147 |  |     public function notFound($status = 404, $returnType = 'html', $message = 'Not Found') : void | 
                                                            
                                    | 148 |  |     { |