Replaced intval with (int) constructor.

This commit is contained in:
alext 2017-08-08 09:49:39 +02:00
parent d685cae118
commit 32b275b73c
8 changed files with 25 additions and 25 deletions

View File

@ -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;
}
/**

View File

@ -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();
}
/**

View File

@ -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'];
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}

View File

@ -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;
}
/**

View File

@ -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'];
}
/**

View File

@ -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;