From ac5cb4b8b99685f94c5c54ec3a2cb3da70d85a8f Mon Sep 17 00:00:00 2001 From: bim-g Date: Mon, 2 Sep 2024 03:16:07 +0200 Subject: [PATCH] [UPD] remove contructor params that are not used often --- src/Core/View.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Core/View.php b/src/Core/View.php index 2d2d97f..6c4aae5 100644 --- a/src/Core/View.php +++ b/src/Core/View.php @@ -47,14 +47,6 @@ class View */ private string $layout_content = ''; - /** - * - */ - public function __construct() - { - $this->folder_name = Application::getViewFolder(); - } - /** * @param string $js_link * @@ -95,7 +87,7 @@ public static function setMetaData(MetaData $metadata) */ public function setFolder(string $folder_name) { - $this->folder_name = Escape::addSlaches($folder_name); + $this->folder_name = Escape::addSlashes($folder_name); } /** @@ -123,8 +115,9 @@ public function display(string $view) */ private function buildFilePath(string $file_name): ?string { + $folder = strlen(trim($this->folder_name)) > 0 ? $this->folder_name : Application::getViewFolder();; $view_file = Escape::checkFileExtension($file_name); - $file_source = $this->folder_name . Escape::addSlaches($view_file); + $file_source = $folder . Escape::addSlashes($view_file); return Application::$ROOT_DIR . '/views' . $file_source; }