diff --git a/app/lib/App/Core/App.php b/app/lib/App/Core/App.php index 97b75ec..3b5a7e0 100644 --- a/app/lib/App/Core/App.php +++ b/app/lib/App/Core/App.php @@ -32,42 +32,32 @@ class App /** * Grab model - * - * TODO: have a look to see if this might name conflict with anything and - * maybe also throw an exception if the model class is not found within the file */ - public function model(string $model, mixed $injection = NULL): object + public function model(string $model_name): object { // require model file - $path = $this->dir . '/model/' . $model . '.php'; + $path = $this->dir . '/model/' . $model_name . '.php'; if (!file_exists($path)) { throw new Exception("Model does not exist"); } require $path; - // instantiate model - if (!$injection) - { - $injection = $this->database; - } - return new $model($injection); + return new $model_name($this->database); } /** * Render given view - * - * Reason for the funky names is to avoid name conflicts */ - public function view(string $__VIEW, array $__DATA = []): void + public function view(string $_view, array $_data = []): void { - $__PATH = $this->dir . '/view/' . $__VIEW . '.php'; - if (!file_exists($__PATH)) + $_path = $this->dir . '/view/' . $_view . '.php'; + if (!file_exists($_path)) { throw new Exception("View does not exist"); } // import variables into the current symbol table from an array - extract($__DATA); - require $__PATH; + extract($_data); + require $_path; } /**