mambax7/cardealer

View on GitHub

Showing 25 of 664 total issues

Function truncateHtml has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    {
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (strlen(preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Severity: Minor
Found in class/Utility.php - About 1 day 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 xoops_module_update_cardealer has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_cardealer(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName      = basename(dirname(__DIR__));

    /** @var Cardealer\Helper $helper */
Severity: Minor
Found in include/onupdate.php - About 1 day 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

File xoops_version.php has 447 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 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
Severity: Minor
Found in xoops_version.php - About 6 hrs to fix

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

        public static function deleteDirectory($src)
        {
            // Only continue if user is a 'global' Admin
            if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                return false;
    Severity: Minor
    Found in class/Common/FilesManagement.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 truncateHtml has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
        {
            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (strlen(preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
    Severity: Major
    Found in class/Utility.php - About 2 hrs to fix

      Method xoops_module_update_cardealer has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_update_cardealer(\XoopsModule $module, $previousVersion = null)
      {
          $moduleDirName      = basename(dirname(__DIR__));
      
          /** @var Cardealer\Helper $helper */
      Severity: Major
      Found in include/onupdate.php - About 2 hrs to fix

        Method __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct($target)
            {
                global $helper;
                $this->targetObject = $target;
        
        
        Severity: Minor
        Found in class/Form/PartForm.php - About 1 hr to fix

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

              public static function xcopy($source, $dest)
              {
                  // Check for symlinks
                  if (is_link($source)) {
                      return symlink(readlink($source), $dest);
          Severity: Minor
          Found in class/Common/FilesManagement.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 __construct has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct($target)
              {
                  global $helper;
                  $this->targetObject = $target;
          
          
          Severity: Minor
          Found in class/Form/VehicleForm.php - About 1 hr to fix

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

            function xoops_module_install_cardealer(\XoopsModule $module)
            {
                $moduleDirName = basename(dirname(__DIR__));
            
                /** @var Cardealer\Helper $helper */
            Severity: Minor
            Found in include/oninstall.php - About 1 hr to fix

              Function rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function rrmdir($src)
                  {
                      // Only continue if user is a 'global' Admin
                      if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                          return false;
              Severity: Minor
              Found in class/Common/FilesManagement.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 getServerStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getServerStats()
                  {
                      $moduleDirName      = basename(dirname(dirname(__DIR__)));
                      $moduleDirNameUpper = strtoupper($moduleDirName);
                      xoops_loadLanguage('common', $moduleDirName);
              Severity: Minor
              Found in class/Common/ServerStats.php - About 1 hr to fix

                Method __construct has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __construct($target)
                    {
                        global $helper;
                        $this->targetObject = $target;
                
                
                Severity: Minor
                Found in class/Form/ServiceForm.php - About 1 hr to fix

                  Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct($target)
                      {
                          global $helper;
                          $this->targetObject = $target;
                  
                  
                  Severity: Minor
                  Found in class/Form/CustomerForm.php - About 1 hr to fix

                    Method deleteDirectory has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function deleteDirectory($src)
                        {
                            // Only continue if user is a 'global' Admin
                            if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                                return false;
                    Severity: Minor
                    Found in class/Common/FilesManagement.php - About 1 hr to fix

                      Method __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function __construct($target)
                          {
                              global $helper;
                              $this->targetObject = $target;
                      
                      
                      Severity: Minor
                      Found in class/Form/WorkorderForm.php - About 1 hr to fix

                        Function xoops_module_install_cardealer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function xoops_module_install_cardealer(\XoopsModule $module)
                        {
                            $moduleDirName = basename(dirname(__DIR__));
                        
                            /** @var Cardealer\Helper $helper */
                        Severity: Minor
                        Found in include/oninstall.php - About 55 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

                        Function rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function rmove($src, $dest)
                            {
                                // Only continue if user is a 'global' Admin
                                if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                                    return false;
                        Severity: Minor
                        Found in class/Common/FilesManagement.php - About 55 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

                        Function rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function rcopy($src, $dest)
                            {
                                // Only continue if user is a 'global' Admin
                                if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                                    return false;
                        Severity: Minor
                        Found in class/Common/FilesManagement.php - About 55 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

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

                            public static function recurseCopy($src, $dst)
                            {
                                $dir = opendir($src);
                                while (false !== ($file = readdir($dir))) {
                                    if (('.' !== $file) && ('..' !== $file)) {
                        Severity: Minor
                        Found in class/Common/FilesManagement.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

                        Severity
                        Category
                        Status
                        Source
                        Language