From e1fb285da7f5594d52f9480afa5d2242219fce33 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 7 Feb 2023 11:07:43 +0400 Subject: [PATCH] Formatting - Convert indents to tabs - Remove unnecessary else statement - Correct PHPDoc formatting --- app/Controllers/Home.php | 14 ++++----- app/Events/Load_config.php | 64 +++++++++++++++++++------------------- app/Models/Employee.php | 24 +++++++------- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 090cfef58..0dbe0a279 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -19,9 +19,9 @@ class Home extends Secure_Controller $this->employee->logout(); } - /* - Load "change employee password" form - */ + /** + * Load "change employee password" form + */ public function change_password(int $employee_id = -1): void //TODO: Replace -1 with a constant { $person_info = $this->employee->get_info($employee_id); @@ -34,9 +34,9 @@ class Home extends Secure_Controller echo view('home/form_change_password', $data); } - /* - Change employee password - */ + /** + * Change employee password + */ public function save(int $employee_id = -1): void //TODO: Replace -1 with a constant { if($this->request->getPost('current_password') != '' && $employee_id != -1) @@ -84,4 +84,4 @@ class Home extends Secure_Controller ]); } } -} \ No newline at end of file +} diff --git a/app/Events/Load_config.php b/app/Events/Load_config.php index ceb6e9473..1113273f9 100644 --- a/app/Events/Load_config.php +++ b/app/Events/Load_config.php @@ -16,48 +16,48 @@ use Config\Services; */ class Load_config { - /** - * Loads configuration from database into App CI config and then applies those settings - */ - public function load_config() - { - //Migrations - $migration_config = config('Migrations'); - $migration = new MY_Migration($migration_config); + /** + * Loads configuration from database into App CI config and then applies those settings + */ + public function load_config() + { + //Migrations + $migration_config = config('Migrations'); + $migration = new MY_Migration($migration_config); - $this->session = session(); + $this->session = session(); - //Database Configuration - $config = config('OSPOS'); - $appconfig = model(Appconfig::class); + //Database Configuration + $config = config('OSPOS'); + $appconfig = model(Appconfig::class); if (!$migration->is_latest()) - { - $this->session->destroy(); - } + { + $this->session->destroy(); + } $config->settings['application_version'] = $migration->get_current_version(); - foreach($appconfig->get_all()->getResult() as $app_config) - { - $config->settings[$app_config->key] = $app_config->value; - } + foreach($appconfig->get_all()->getResult() as $app_config) + { + $config->settings[$app_config->key] = $app_config->value; + } - //Language + //Language helper('locale'); - $language_exists = file_exists('../app/Language/' . current_language_code()); + $language_exists = file_exists('../app/Language/' . current_language_code()); - if(current_language_code() == null || current_language() == null || !$language_exists) //TODO: current_language() is undefined - { - $config->language = 'english'; - $config->language_code = 'en-US'; - } + if(current_language_code() == null || current_language() == null || !$language_exists) //TODO: current_language() is undefined + { + $config->language = 'english'; + $config->language_code = 'en-US'; + } - $language = Services::language(); - $language->setLocale($config->settings['language_code']); + $language = Services::language(); + $language->setLocale($config->settings['language_code']); - //Time Zone - date_default_timezone_set($config->timezone ?? 'America/New_York'); + //Time Zone + date_default_timezone_set($config->timezone ?? 'America/New_York'); - bcscale(max(2, totals_decimals() + tax_decimals())); - } + bcscale(max(2, totals_decimals() + tax_decimals())); + } } diff --git a/app/Models/Employee.php b/app/Models/Employee.php index 062f2a4a5..621fa3661 100644 --- a/app/Models/Employee.php +++ b/app/Models/Employee.php @@ -80,20 +80,18 @@ class Employee extends Person { return $query->getRow(); } - else //TODO: No need for this else statement. Just put it's contents outside of the else since the if has a return in it. + + //Get empty base parent object, as $employee_id is NOT an employee + $person_obj = parent::get_info(-1); //TODO: Replace -1 with a constant + + //Get all the fields from employee table + //append those fields to base parent object, we have a complete empty object + foreach($this->db->getFieldNames('employees') as $field) { - //Get empty base parent object, as $employee_id is NOT an employee - $person_obj = parent::get_info(-1); //TODO: Replace -1 with a constant - - //Get all the fields from employee table - //append those fields to base parent object, we have a complete empty object - foreach($this->db->getFieldNames('employees') as $field) - { - $person_obj->$field = ''; - } - - return $person_obj; + $person_obj->$field = ''; } + + return $person_obj; } /** @@ -547,4 +545,4 @@ class Employee extends Person return $success; } -} \ No newline at end of file +}