XoopsModules25x/xsitemap

View on GitHub
class/Utility.php

Summary

Maintainability
D
1 day
Test Coverage

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

    public static function saveSitemap(array $xsitemap_show)
    {
        $xml                     = new \DOMDocument('1.0', 'UTF-8');
        $xml->preserveWhiteSpace = false;
        $xml->formatOutput       = true;
Severity: Minor
Found in class/Utility.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

Function generateSitemap has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function generateSitemap()
    {
        $block         = [];
        $moduleDirName = \basename(\dirname(__DIR__));
        /** @internal can't use Helper since function called during install
Severity: Minor
Found in class/Utility.php - About 2 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 getSitemap has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getSitemap($table, $id_name, $pid_name, $title_name, $url, $order = '', $where = '')
    {
        require_once XOOPS_ROOT_PATH . '/class/tree.php';
        $helper = Helper::getInstance();
        /** @var \XoopsMySQLDatabase $xoopsDb */
Severity: Minor
Found in class/Utility.php - About 2 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 generateSitemap has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function generateSitemap()
    {
        $block         = [];
        $moduleDirName = \basename(\dirname(__DIR__));
        /** @internal can't use Helper since function called during install
Severity: Major
Found in class/Utility.php - About 2 hrs to fix

    Method getSitemap has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getSitemap($table, $id_name, $pid_name, $title_name, $url, $order = '', $where = '')
        {
            require_once XOOPS_ROOT_PATH . '/class/tree.php';
            $helper = Helper::getInstance();
            /** @var \XoopsMySQLDatabase $xoopsDb */
    Severity: Major
    Found in class/Utility.php - About 2 hrs to fix

      Method saveSitemap has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function saveSitemap(array $xsitemap_show)
          {
              $xml                     = new \DOMDocument('1.0', 'UTF-8');
              $xml->preserveWhiteSpace = false;
              $xml->formatOutput       = true;
      Severity: Minor
      Found in class/Utility.php - About 1 hr to fix

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

            public static function getSitemap($table, $id_name, $pid_name, $title_name, $url, $order = '', $where = '')
        Severity: Major
        Found in class/Utility.php - About 50 mins to fix

          There are no issues that match your filters.

          Category
          Status