From 41a8adc3ea11e926c34fc882e486bb39aa89196f Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Tue, 5 Jan 2021 14:23:42 +0100 Subject: [PATCH] config gets initialized in index.php (only if needed) --- Object.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Object.php b/Object.php index 29fbad5..c702538 100644 --- a/Object.php +++ b/Object.php @@ -13,11 +13,10 @@ } } - public function parse():void { - $config = new config(); - $db = new database(host: $config->get("db.host"), user: $config->get("db.user"), pass: $config->get("db.pass"), name: $config->get("db.name")); + public function parse($db_config):void { + $db = new database(host: $db_config["host"], user: $db_config["user"], pass: $db_config["pass"], name: $db_config["name"]); // Route Table Name - $rtn = $config->get("db.prefix")."routes"; + $rtn = $db_config["prefix"]."routes"; $db->prepare("SELECT * FROM ".$rtn." WHERE ".$rtn.".uri = :request_uri"); $db->bind_and_execute([ ":request_uri" => $this->request_uri,