spotweb/spotweb

View on GitHub
lib/page/SpotPage_catsjson.php

Summary

Maintainability
F
3 days
Test Coverage

Function categoriesToJson has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

    public function categoriesToJson()
    {
        /*
         * Don't allow the tree to be cached, it contains the current state of the
         * tree
Severity: Minor
Found in lib/page/SpotPage_catsjson.php - About 2 days 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 categoriesToJson has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function categoriesToJson()
    {
        /*
         * Don't allow the tree to be cached, it contains the current state of the
         * tree
Severity: Major
Found in lib/page/SpotPage_catsjson.php - About 3 hrs to fix

    Function renderSelectBox has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function renderSelectBox()
        {
            /*
             * The categorylisting is very static, so ask the user to always cache
             */
    Severity: Minor
    Found in lib/page/SpotPage_catsjson.php - About 3 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 renderSelectBox has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function renderSelectBox()
        {
            /*
             * The categorylisting is very static, so ask the user to always cache
             */
    Severity: Major
    Found in lib/page/SpotPage_catsjson.php - About 2 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                                              if (!$isStrongNot) {
                                                  $isStrongNot = strpos($compressedCatList, ',~cat'.$hcat_key.'_z'.$type_key.'_'.$sclist_key.$key.',') !== false ? true : false;
                                              } // if
      Severity: Major
      Found in lib/page/SpotPage_catsjson.php - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status