Admidio/admidio

View on GitHub
adm_program/system/classes/MenuNode.php

Summary

Maintainability
B
4 hrs
Test Coverage

Function loadFromDatabase has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFromDatabase(int $nodeId)
    {
        global $gDb, $gValidLogin;

        $sql = 'SELECT men_id, men_com_id, men_name_intern, men_name, men_description, men_url, men_icon, com_name_intern
Severity: Minor
Found in adm_program/system/classes/MenuNode.php - About 1 hr 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 loadFromDatabase has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function loadFromDatabase(int $nodeId)
    {
        global $gDb, $gValidLogin;

        $sql = 'SELECT men_id, men_com_id, men_name_intern, men_name, men_description, men_url, men_icon, com_name_intern
Severity: Minor
Found in adm_program/system/classes/MenuNode.php - About 1 hr to fix

    Method addItem has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function addItem(string $id, string $name, string $url, string $icon, string $parentMenuItemId = '', int $badgeCount = 0, string $description = '')
    Severity: Major
    Found in adm_program/system/classes/MenuNode.php - About 50 mins to fix

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

          public function addItem(string $id, string $name, string $url, string $icon, string $parentMenuItemId = '', int $badgeCount = 0, string $description = '')
          {
              $node['id'] = $id;
      
              // translate name and description
      Severity: Minor
      Found in adm_program/system/classes/MenuNode.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