diff --git a/src/bootstrap/safer_io.php b/src/bootstrap/safer_io.php index e2b9307..ec84d6f 100644 --- a/src/bootstrap/safer_io.php +++ b/src/bootstrap/safer_io.php @@ -55,23 +55,32 @@ final class use_io { */ final class use_iol { public static function auto_wire( + object $app, string $root_folder, string $file, string $method = 'index', - string $db_service= 'db_mocker' + ?string $db_service= 'db_mocker' ) { new \CodeHydrater\enums\safer_io_enums(); // Auto load - registry::set('db', \main_tts\registry::get('di')->get_service($db_service) ); + if ($db_service !== null && !empty($db_service)) { + if (\main_tts\registry::get('di')->has($db_service)) { + registry::set('db', \main_tts\registry::get('di')->get_service($db_service) ); + } else { + // set error + } + } $class_name = "\\Project\\inputs\\{$root_folder}\\{$file}_in"; - $input = $class_name::$method(); + $input = $class_name::$method($app); $class_name = "\\Project\\logic\\{$root_folder}\\{$file}_logic"; - $class_name::$method($input); + if (method_exists($class_name, $method)) { + $class_name::$method($app, $input); + } $class_name = "\\Project\\outputs\\{$root_folder}\\{$file}_out"; - return $class_name::$method($input); + return $class_name::$method($app, $input); } } diff --git a/src/classes/base_controller.php b/src/classes/base_controller.php index b7e23e1..2ca5a07 100644 --- a/src/classes/base_controller.php +++ b/src/classes/base_controller.php @@ -21,14 +21,14 @@ use \CodeHydrater\http\response as Response; */ class base_controller { public static $params; // To keep Routes working... - protected $view; - protected $html; + public $view; + public $html; protected string $footer = ""; protected string $authors = ""; public function __construct( - protected Request $request, - protected Response $response + public Request $request, + public Response $response ) { $this->view = new \CodeHydrater\view(); $this->html = new \CodeHydrater\html_document(); diff --git a/src/classes/html.php b/src/classes/html.php index f2a03b1..c1dcb6a 100644 --- a/src/classes/html.php +++ b/src/classes/html.php @@ -70,7 +70,7 @@ final class html { echo "{$nl}
| {$field} | {$nl}"; } echo "\t
|---|
| {$cell} | {$nl}"; } echo "\t