File User_model.php
has 542 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* PepisCMS
*
User_model
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class User_model extends Generic_model
{
/**
* Minimum minimum allowed length of the password
Method register
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register($display_name, $user_email, $user_login = false, $password = false, $group_ids = array(), $is_root = false, $send_email_notification = true, $data = array(), $account_type = 0)
{
// If there is no password specified, lets generate one for the user
if (!$password) {
$password = $this->generateEasyPassword($this->getMinimumAllowedPasswordLenght() + 2);
Function register
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function register($display_name, $user_email, $user_login = false, $password = false, $group_ids = array(), $is_root = false, $send_email_notification = true, $data = array(), $account_type = 0)
{
// If there is no password specified, lets generate one for the user
if (!$password) {
$password = $this->generateEasyPassword($this->getMinimumAllowedPasswordLenght() + 2);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function update($user_id, $display_name, $user_login = false, $group_ids = false, $password = false, $is_root = null, $data = array())
{
// Change user password if specified
if ($password) {
$this->changePasswordByUserId($user_id, $password);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method resetPasswordByUserId
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resetPasswordByUserId($user_id)
{
// Reading user info
$user = $this->getById($user_id, 'user_email, display_name');
if (!$user) {
Method register
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function register($display_name, $user_email, $user_login = false, $password = false, $group_ids = array(), $is_root = false, $send_email_notification = true, $data = array(), $account_type = 0)
Method validateByUserId
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateByUserId($user_id, $password)
{
// Attempt to select user password metadata
$row = $this->db->select('user_id, hashing_salt, hashing_algorithm, hashing_iterations')
->from($this->getTable())
Method validateByEmail
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateByEmail($user_email, $password)
{
// Attempt to select user password metadata
$row = $this->db->select('user_id, hashing_salt, hashing_algorithm, hashing_iterations')
->from($this->getTable())
Method validateByLogin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateByLogin($user_login, $password)
{
$row = $this->db->select('user_id, hashing_salt, hashing_algorithm, hashing_iterations')
->from($this->getTable())
->where('user_login', $user_login)
Method update
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function update($user_id, $display_name, $user_login = false, $group_ids = false, $password = false, $is_root = null, $data = array())
Function resetPasswordByUserId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function resetPasswordByUserId($user_id)
{
// Reading user info
$user = $this->getById($user_id, 'user_email, display_name');
if (!$user) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"