mambax7/randomquote

View on GitHub

Showing 32 of 45 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_randomquote has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

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

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

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

    public function __construct($target)
    {
        global $helper;
        $this->targetObject = $target;

Severity: Major
Found in class/form/CategoryForm.php - About 5 hrs to fix

    File xoops_version.php has 364 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 4 hrs to fix

      Function __construct has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($target)
          {
              global $helper;
              $this->targetObject = $target;
      
      
      Severity: Minor
      Found in class/form/CategoryForm.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 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_randomquote has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_randomquote(\XoopsModule $module, $previousVersion = null)
        {
            $moduleDirName      = basename(dirname(__DIR__));
            $moduleDirNameUpper = strtoupper($moduleDirName);
        
        
        Severity: Major
        Found in include/onupdate.php - About 2 hrs to fix

          Method showRandomquoteBlockViews has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function showRandomquoteBlockViews($options)
          {
              $moduleDirName = basename(dirname(__DIR__));
              //    require_once XOOPS_ROOT_PATH . '/modules/randomquote/class/quotes.php';
              $utility = new randomquote\Utility();
          Severity: Minor
          Found in blocks/views.php - About 1 hr to fix

            Method xoops_module_install_randomquote has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoops_module_install_randomquote(\XoopsModule $module)
            {
                include __DIR__ . '/../preloads/autoloader.php';
            
                $moduleDirName = basename(dirname(__DIR__));
            Severity: Minor
            Found in include/oninstall.php - About 1 hr to fix

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

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

                Method randomquote_search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function randomquote_search($queryarray, $andor, $limit, $offset, $userid)
                {
                    $ret = array();
                    if (0 != (int)$userid) {
                        return $ret;
                Severity: Minor
                Found in include/search.inc.php - About 1 hr to fix

                  Method setPermissions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid)
                          {
                              $permissionArray = $myArray;
                              if ($id > 0) {
                                  $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name` = '" . $permissionName . "' AND `gperm_itemid`= $id;";
                  Severity: Minor
                  Found in admin/category.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

                    Function xcopy has a Cognitive Complexity of 11 (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 randomquote_tag_iteminfo has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function randomquote_tag_iteminfo(&$items)
                    {
                        if (empty($items) || !is_array($items)) {
                            return false;
                        }
                    Severity: Minor
                    Found in include/plugin.tag.php - About 1 hr to fix

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

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

                        Method randomquote_tag_synchronization has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function randomquote_tag_synchronization($mid)
                        {
                            $moduleDirName = basename(dirname(__DIR__));
                            require_once $GLOBALS['xoops']->path("/modules/{$moduleDirName}/class/constants.php");
                        
                        
                        Severity: Minor
                        Found in include/plugin.tag.php - About 1 hr to fix

                          Method deleteDirectory has 26 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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language