application/modules/wishlist/models/wishlist_model.php
File wishlist_model.php
has 524 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
use cmsemail\email;
use CMSFactory\ModuleSettings;
use core\models\Route;
- Create a ticketCreate a ticket
Wishlist_model
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Wishlist_model extends CI_Model
{
public function __construct() {
parent::__construct();
- Create a ticketCreate a ticket
Method install
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function install() {
$this->load->dbforge();
($this->dx_auth->is_admin()) OR exit;
@mkdir('./uploads/mod_wishlist', 0777);
- Create a ticketCreate a ticket
Method getUserWishListsByID
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getUserWishListsByID($user_id, $access = ['public', 'shared', 'private']) {
$locale = \MY_Controller::getCurrentLocale();
$queryFirst = $this->db
->select('*, shop_product_variants.mainImage AS `image`, mod_wish_list_products.id AS list_product_id, route.url, route.parent_url')
->where('mod_wish_list.user_id', $user_id)
- Create a ticketCreate a ticket
Method getUserWishList
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getUserWishList($user_id, $list_id, $access = ['public', 'shared', 'private']) {
$locale = \MY_Controller::getCurrentLocale();
$query = $this->db
->where('mod_wish_list.user_id', $user_id)
->where_in('access', $access)
- Create a ticketCreate a ticket
Function getUserWishListsByID
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getUserWishListsByID($user_id, $access = ['public', 'shared', 'private']) {
$locale = \MY_Controller::getCurrentLocale();
$queryFirst = $this->db
->select('*, shop_product_variants.mainImage AS `image`, mod_wish_list_products.id AS list_product_id, route.url, route.parent_url')
->where('mod_wish_list.user_id', $user_id)
- Read upRead up
- Create a ticketCreate a ticket
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"