mambax7/smartobject

View on GitHub
class/Table.php

Summary

Maintainability
F
5 days
Test Coverage

File Table.php has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace XoopsModules\Smartobject;

/**
 * Contains the classes responsible for displaying a simple table filled with records of SmartObjects
 *
Severity: Major
Found in class/Table.php - About 1 day to fix

    Function createTableRows has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createTableRows()
        {
            $this->_aObjects = [];
    
            $doWeHaveActions = false;
    Severity: Minor
    Found in class/Table.php - About 7 hrs 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

    Function render has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render($fetchOnly = false, $debug = false)
        {
            require_once XOOPS_ROOT_PATH . '/class/template.php';
    
            $this->_tpl = new \XoopsTpl();
    Severity: Minor
    Found in class/Table.php - About 7 hrs 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

    Method render has 166 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render($fetchOnly = false, $debug = false)
        {
            require_once XOOPS_ROOT_PATH . '/class/template.php';
    
            $this->_tpl = new \XoopsTpl();
    Severity: Major
    Found in class/Table.php - About 6 hrs to fix

      Table has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Table
      {
          public $_id;
          public $_objectHandler;
          public $_columns;
      Severity: Minor
      Found in class/Table.php - About 5 hrs to fix

        Method createTableRows has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createTableRows()
            {
                $this->_aObjects = [];
        
                $doWeHaveActions = false;
        Severity: Major
        Found in class/Table.php - About 2 hrs to fix

          Function getFiltersArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getFiltersArray()
              {
                  $ret               = [];
                  $field             = [];
                  $field['caption']  = _CO_OBJ_NONE;
          Severity: Minor
          Found in class/Table.php - About 45 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