XoopsModules25x/userlog

View on GitHub

Showing 1,244 of 1,244 total issues

Method createCacheNewWay has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function createCacheNewWay($iniContent)
    {
        $patternPositions = [];

        // get all patterns from the ini file in the correct order,
Severity: Major
Found in class/phpbrowscap/Browscap.php - About 4 hrs to fix

    Method getViews has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getViews(
            $limit = 10,
            $start = 0,
            $sort = 'count',
            $order = 'DESC',
    Severity: Major
    Found in class/log.php - About 4 hrs to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      function update_userlog_v114(XoopsModule $module)
      {
          $userlog    = Userlog::getInstance();
          $logsetsObj = $userlog->getHandler('setting')->getAll();
          $ret        = true;
      Severity: Major
      Found in include/onupdate.php and 1 other location - About 3 hrs to fix
      include/module.php on lines 102..119

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      function update_userlog_v114(XoopsModule $module)
      {
          $userlog    = Userlog::getInstance();
          $logsetsObj = $userlog->getHandler('setting')->getAll();
          $ret        = true;
      Severity: Major
      Found in include/module.php and 1 other location - About 3 hrs to fix
      include/onupdate.php on lines 91..108

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method updateAll has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateAll($type = 'log', $prob = 11)
          {
              if (!$this->userlog->probCheck($prob)) {
                  return false;
              }
      Severity: Major
      Found in class/stats.php - About 3 hrs to fix

        Function _getRemoteData has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _getRemoteData($url)
            {
                ini_set('user_agent', $this->_getUserAgent());
        
                switch ($this->_getUpdateMethod()) {
        Severity: Minor
        Found in class/phpbrowscap/Browscap.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 getBrowser has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getBrowser($user_agent = null, $return_array = false)
            {
                if ($this->shouldCacheBeUpdated()) {
                    try {
                        $this->updateCache();
        Severity: Major
        Found in class/phpbrowscap/Browscap.php - About 3 hrs to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          function update_userlog_v116(XoopsModule $module)
          {
              // remove old html template files
              $template_directory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/';
              $template_list      = array_diff(scandir($template_directory, SCANDIR_SORT_NONE), ['..', '.']);
          Severity: Major
          Found in include/onupdate.php and 1 other location - About 3 hrs to fix
          include/module.php on lines 152..165

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 150.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          function update_userlog_v100(XoopsModule $module)
          {
              $field   = 'module_name';
              $userlog  = Userlog::getInstance();
              $ret     = $userlog->getHandler('log')->showFields($field);
          Severity: Major
          Found in include/module.php and 1 other location - About 3 hrs to fix
          include/onupdate.php on lines 68..83

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 150.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          function update_userlog_v100(XoopsModule $module)
          {
              $field   = 'module_name';
              $userlog  = Userlog::getInstance();
              $ret     = $userlog->getHandler('log')->showFields($field);
          Severity: Major
          Found in include/onupdate.php and 1 other location - About 3 hrs to fix
          include/module.php on lines 79..94

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 150.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          function update_userlog_v116(XoopsModule $module)
          {
              // remove old html template files
              $template_directory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/';
              $template_list      = array_diff(scandir($template_directory, SCANDIR_SORT_NONE), ['..', '.']);
          Severity: Major
          Found in include/module.php and 1 other location - About 3 hrs to fix
          include/onupdate.php on lines 141..154

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 150.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Browscap has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Browscap
          {
              /**
               * Current version of the class.
               */
          Severity: Minor
          Found in class/phpbrowscap/Browscap.php - About 3 hrs to fix

            The class UserlogLog has 19 public methods. Consider refactoring UserlogLog to keep number of public methods under 10.
            Open

            class UserlogLog extends XoopsObject
            {
                /**
                 * @var string
                 */
            Severity: Minor
            Found in class/log.php by phpmd

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            The class Userlog has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
            Open

            class Userlog extends \Xmf\Module\Helper
            {
                public $logmodule;
                public $user;
                public $debugArray   = [];
            Severity: Minor
            Found in class/helper.php by phpmd

            The class UserlogLog has an overall complexity of 179 which is very high. The configured complexity threshold is 50.
            Open

            class UserlogLog extends XoopsObject
            {
                /**
                 * @var string
                 */
            Severity: Minor
            Found in class/log.php by phpmd

            The class UserlogSetting has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
            Open

            class UserlogSetting extends XoopsObject
            {
                /**
                 * @var string
                 */
            Severity: Minor
            Found in class/setting.php by phpmd

            The class UserlogLogHandler has 11 public methods. Consider refactoring UserlogLogHandler to keep number of public methods under 10.
            Open

            class UserlogLogHandler extends XoopsPersistableObjectHandler
            {
                public $userlog = null;
            
                /**
            Severity: Minor
            Found in class/log.php by phpmd

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            The class UserlogLogHandler has an overall complexity of 63 which is very high. The configured complexity threshold is 50.
            Open

            class UserlogLogHandler extends XoopsPersistableObjectHandler
            {
                public $userlog = null;
            
                /**
            Severity: Minor
            Found in class/log.php by phpmd

            The class Browscap has an overall complexity of 167 which is very high. The configured complexity threshold is 50.
            Open

            class Browscap
            {
                /**
                 * Current version of the class.
                 */
            Severity: Minor
            Found in class/phpbrowscap/Browscap.php by phpmd

            The class UserlogStats has an overall complexity of 62 which is very high. The configured complexity threshold is 50.
            Open

            class UserlogStats extends XoopsObject
            {
                /**
                 * @var string
                 */
            Severity: Minor
            Found in class/stats.php by phpmd
            Severity
            Category
            Status
            Source
            Language