XoopsModules25x/news

View on GitHub
include/functions.php

Summary

Maintainability
F
4 days
Test Coverage

File functions.php has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);
/*
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Major
Found in include/functions.php - About 1 day to fix

    Method news_createmeta_keywords has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function news_createmeta_keywords($content)
    {
        require_once XOOPS_ROOT_PATH . '/modules/news/config.php';
        // require_once XOOPS_ROOT_PATH . '/modules/news/class/blacklist.php';
        // require_once XOOPS_ROOT_PATH . '/modules/news/class/registryfile.php';
    Severity: Major
    Found in include/functions.php - About 4 hrs to fix

      Function news_CreateMetaDatas has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function news_CreateMetaDatas($story = null): void
      {
          global $xoopsConfig, $xoTheme, $xoopsTpl;
          $content = '';
          $myts    = \MyTextSanitizer::getInstance();
      Severity: Minor
      Found in include/functions.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 news_CreateMetaDatas has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function news_CreateMetaDatas($story = null): void
      {
          global $xoopsConfig, $xoTheme, $xoopsTpl;
          $content = '';
          $myts    = \MyTextSanitizer::getInstance();
      Severity: Major
      Found in include/functions.php - About 2 hrs to fix

        Method news_getWysiwygForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
        {
            $editor_option            = \mb_strtolower(news_getmoduleoption('form_options'));
            $editor                   = false;
            $editor_configs           = [];
        Severity: Major
        Found in include/functions.php - About 2 hrs to fix

          Function news_createmeta_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function news_createmeta_keywords($content)
          {
              require_once XOOPS_ROOT_PATH . '/modules/news/config.php';
              // require_once XOOPS_ROOT_PATH . '/modules/news/class/blacklist.php';
              // require_once XOOPS_ROOT_PATH . '/modules/news/class/registryfile.php';
          Severity: Minor
          Found in include/functions.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 news_close_tags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function news_close_tags($string)
          {
              // match opened tags
              if (preg_match_all('/<([a-z\:\-]+)[^\/]>/', $string, $start_tags)) {
                  $start_tags = $start_tags[1];
          Severity: Minor
          Found in include/functions.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 news_html2text has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function news_html2text($document)
          {
              // PHP Manual:: function preg_replace
              // $document should contain an HTML document.
              // This will remove HTML tags, javascript sections
          Severity: Minor
          Found in include/functions.php - About 1 hr to fix

            Function news_getWysiwygForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
            {
                $editor_option            = \mb_strtolower(news_getmoduleoption('form_options'));
                $editor                   = false;
                $editor_configs           = [];
            Severity: Minor
            Found in include/functions.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

            Function news_getmoduleoption has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function news_getmoduleoption($option, $repmodule = 'news')
            {
                global $xoopsModuleConfig, $xoopsModule;
                static $tbloptions = [];
                if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
            Severity: Minor
            Found in include/functions.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

            Function news_updateCache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function news_updateCache(): void
            {
                global $xoopsModule;
                $folder  = $xoopsModule->getVar('dirname');
                $tpllist = [];
            Severity: Minor
            Found in include/functions.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 news_getWysiwygForm has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
            Severity: Minor
            Found in include/functions.php - About 45 mins to fix

              Method news_resizePicture has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  $src_path,
                  $dst_path,
                  $param_width,
                  $param_height,
                  $keep_original = false,
              Severity: Minor
              Found in include/functions.php - About 45 mins to fix

                Function news_resizePicture has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function news_resizePicture(
                    $src_path,
                    $dst_path,
                    $param_width,
                    $param_height,
                Severity: Minor
                Found in include/functions.php - About 35 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