From 32b275b73ce8d26e595804cd99ab7dee35e4e88a Mon Sep 17 00:00:00 2001 From: alext Date: Tue, 8 Aug 2017 09:49:39 +0200 Subject: [PATCH] Replaced intval with (int) constructor. --- src/application/models/Admins_model.php | 10 +++++----- src/application/models/Appointments_model.php | 2 +- src/application/models/Customers_model.php | 4 ++-- src/application/models/Providers_model.php | 8 ++++---- src/application/models/Roles_model.php | 6 +++--- src/application/models/Secretaries_model.php | 10 +++++----- src/application/models/Services_model.php | 6 +++--- src/application/models/Settings_model.php | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/application/models/Admins_model.php b/src/application/models/Admins_model.php index f9cb2ae8..94d61acc 100644 --- a/src/application/models/Admins_model.php +++ b/src/application/models/Admins_model.php @@ -53,7 +53,7 @@ class Admins_Model extends CI_Model { $admin['id'] = $this->update($admin); } - return intval($admin['id']); + return (int)$admin['id']; } /** @@ -101,7 +101,7 @@ class Admins_Model extends CI_Model { throw new Exception('Could not insert admin into the database.'); } - $admin['id'] = intval($this->db->insert_id()); + $admin['id'] = (int)$this->db->insert_id(); $settings['id_users'] = $admin['id']; $settings['salt'] = generate_salt(); $settings['password'] = hash_password($settings['salt'], $settings['password']); @@ -146,7 +146,7 @@ class Admins_Model extends CI_Model { throw new Exception('Could not update admin settings.'); } - return intval($admin['id']); + return (int)$admin['id']; } /** @@ -174,7 +174,7 @@ class Admins_Model extends CI_Model { throw new Exception('Could not find admin record id.'); } - return intval($result->row()->id); + return (int)$result->row()->id; } /** @@ -381,7 +381,7 @@ class Admins_Model extends CI_Model { * @return int Returns the role record id. */ public function get_admin_role_id() { - return intval($this->db->get_where('ea_roles', array('slug' => DB_SLUG_ADMIN))->row()->id); + return (int)$this->db->get_where('ea_roles', array('slug' => DB_SLUG_ADMIN))->row()->id; } /** diff --git a/src/application/models/Appointments_model.php b/src/application/models/Appointments_model.php index 10707a29..c5b424d8 100644 --- a/src/application/models/Appointments_model.php +++ b/src/application/models/Appointments_model.php @@ -90,7 +90,7 @@ class Appointments_Model extends CI_Model { throw new Exception('Could not insert appointment record.'); } - return intval($this->db->insert_id()); + return (int)$this->db->insert_id(); } /** diff --git a/src/application/models/Customers_model.php b/src/application/models/Customers_model.php index 9d8c593d..eb863d8e 100644 --- a/src/application/models/Customers_model.php +++ b/src/application/models/Customers_model.php @@ -98,7 +98,7 @@ class Customers_Model extends CI_Model { throw new Exception('Could not insert customer to the database.'); } - return intval($this->db->insert_id()); + return (int)$this->db->insert_id(); } /** @@ -123,7 +123,7 @@ class Customers_Model extends CI_Model { throw new Exception('Could not update customer to the database.'); } - return intval($customer['id']); + return (int)$customer['id']; } /** diff --git a/src/application/models/Providers_model.php b/src/application/models/Providers_model.php index 2ec1034d..7ffeeb27 100644 --- a/src/application/models/Providers_model.php +++ b/src/application/models/Providers_model.php @@ -68,7 +68,7 @@ class Providers_Model extends CI_Model { $provider['id'] = $this->_update($provider); } - return intval($provider['id']); + return (int)$provider['id']; } /** @@ -128,7 +128,7 @@ class Providers_Model extends CI_Model { $this->save_services($services, $provider['id']); // Return the new record id. - return intval($provider['id']); + return (int)$provider['id']; } /** @@ -162,7 +162,7 @@ class Providers_Model extends CI_Model { $this->save_settings($settings, $provider['id']); // Return record id. - return intval($provider['id']); + return (int)$provider['id']; } /** @@ -190,7 +190,7 @@ class Providers_Model extends CI_Model { throw new Exception('Could not find provider record id.'); } - return intval($result->row()->id); + return (int)$result->row()->id; } /** diff --git a/src/application/models/Roles_model.php b/src/application/models/Roles_model.php index b0850789..fcbe0cd2 100644 --- a/src/application/models/Roles_model.php +++ b/src/application/models/Roles_model.php @@ -55,17 +55,17 @@ class Roles_Model extends CI_Model { ); if ($privileges_number > 0) { - if (intval($privileges_number / PRIV_DELETE) == 1) { + if ((int)($privileges_number / PRIV_DELETE) == 1) { $value['delete'] = TRUE; $privileges_number -= PRIV_DELETE; } - if (intval($privileges_number / PRIV_EDIT) == 1) { + if ((int)($privileges_number / PRIV_EDIT) == 1) { $value['edit'] = TRUE; $privileges_number -= PRIV_EDIT; } - if (intval($privileges_number / PRIV_ADD) == 1) { + if ((int)($privileges_number / PRIV_ADD) == 1) { $value['add'] = TRUE; $privileges_number -= PRIV_ADD; } diff --git a/src/application/models/Secretaries_model.php b/src/application/models/Secretaries_model.php index 9d081e07..ca52d502 100644 --- a/src/application/models/Secretaries_model.php +++ b/src/application/models/Secretaries_model.php @@ -54,7 +54,7 @@ class Secretaries_Model extends CI_Model { $secretary['id'] = $this->_update($secretary); } - return intval($secretary['id']); + return (int)$secretary['id']; } /** @@ -103,7 +103,7 @@ class Secretaries_Model extends CI_Model { throw new Exception('Could not insert secretary into the database.'); } - $secretary['id'] = intval($this->db->insert_id()); + $secretary['id'] = (int)$this->db->insert_id(); $settings['salt'] = generate_salt(); $settings['password'] = hash_password($settings['salt'], $settings['password']); @@ -141,7 +141,7 @@ class Secretaries_Model extends CI_Model { $this->save_providers($providers, $secretary['id']); $this->save_settings($settings, $secretary['id']); - return intval($secretary['id']); + return (int)$secretary['id']; } /** @@ -169,7 +169,7 @@ class Secretaries_Model extends CI_Model { throw new Exception('Could not find secretary record id.'); } - return intval($result->row()->id); + return (int)$result->row()->id; } /** @@ -384,7 +384,7 @@ class Secretaries_Model extends CI_Model { * @return int Returns the role record id. */ public function get_secretary_role_id() { - return intval($this->db->get_where('ea_roles', array('slug' => DB_SLUG_SECRETARY))->row()->id); + return (int)$this->db->get_where('ea_roles', array('slug' => DB_SLUG_SECRETARY))->row()->id; } /** diff --git a/src/application/models/Services_model.php b/src/application/models/Services_model.php index 81f21c15..6f3604e9 100644 --- a/src/application/models/Services_model.php +++ b/src/application/models/Services_model.php @@ -34,7 +34,7 @@ class Services_Model extends CI_Model { $this->_update($service); } - return intval($service['id']); + return (int)$service['id']; } /** @@ -48,7 +48,7 @@ class Services_Model extends CI_Model { if (!$this->db->insert('ea_services', $service)) { throw new Exception('Could not insert service record.'); } - return intval($this->db->insert_id()); + return (int)$this->db->insert_id(); } /** @@ -302,7 +302,7 @@ class Services_Model extends CI_Model { $this->db->update('ea_service_categories', $category); } - return intval($category['id']); + return (int)$category['id']; } /** diff --git a/src/application/models/Settings_model.php b/src/application/models/Settings_model.php index 9563837d..2d29b212 100644 --- a/src/application/models/Settings_model.php +++ b/src/application/models/Settings_model.php @@ -65,7 +65,7 @@ class Settings_Model extends CI_Model { if (!$this->db->update('ea_settings', array('value' => $value), array('name' => $name))) { throw new Exception('Could not update database setting.'); } - $setting_id = intval($this->db->get_where('ea_settings', array('name' => $name))->row()->id); + $setting_id = (int)$this->db->get_where('ea_settings', array('name' => $name))->row()->id; } else { // Insert setting $insert_data = array( @@ -75,7 +75,7 @@ class Settings_Model extends CI_Model { if (!$this->db->insert('ea_settings', $insert_data)) { throw new Exception('Could not insert database setting'); } - $setting_id = intval($this->db->insert_id()); + $setting_id = (int)$this->db->insert_id(); } return $setting_id;