imagecms/ImageCMS

View on GitHub
application/modules/wishlist/models/wishlist_model.php

Summary

Maintainability
D
2 days
Test Coverage

File wishlist_model.php has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use cmsemail\email;
use CMSFactory\ModuleSettings;
use core\models\Route;

Severity: Major
Found in application/modules/wishlist/models/wishlist_model.php - About 1 day to fix

Wishlist_model has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class Wishlist_model extends CI_Model
{

    public function __construct() {
        parent::__construct();
Severity: Minor
Found in application/modules/wishlist/models/wishlist_model.php - About 4 hrs to fix

Method install has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function install() {

        $this->load->dbforge();
        ($this->dx_auth->is_admin()) OR exit;
        @mkdir('./uploads/mod_wishlist', 0777);
Severity: Major
Found in application/modules/wishlist/models/wishlist_model.php - About 4 hrs to fix

Method getUserWishListsByID has 36 lines of code (exceeds 25 allowed). Consider refactoring.
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)
Severity: Minor
Found in application/modules/wishlist/models/wishlist_model.php - About 1 hr to fix

Method getUserWishList has 31 lines of code (exceeds 25 allowed). Consider refactoring.
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)
Severity: Minor
Found in application/modules/wishlist/models/wishlist_model.php - About 1 hr to fix

Function getUserWishListsByID has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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)
Severity: Minor
Found in application/modules/wishlist/models/wishlist_model.php - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status