XoopsModules25x/userlog

View on GitHub

Showing 113 of 1,244 total issues

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

    public function arrayToDisplay($logs, $skips = [])
    {
        foreach ($logs as $log_id => $log) {
            $logs[$log_id]['log_time']   = $this->userlog->formatTime($logs[$log_id]['log_time']);
            $logs[$log_id]['last_login'] = $this->userlog->formatTime($logs[$log_id]['last_login']);
Severity: Minor
Found in class/log.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 _getRemoteData has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _getRemoteData($url)
    {
        ini_set('user_agent', $this->_getUserAgent());

        switch ($this->_getUpdateMethod()) {
Severity: Major
Found in class/phpbrowscap/Browscap.php - About 3 hrs to fix

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

        public function insertUpdate($object, $duplicate = [], $force = true)
        {
            $handler = $this->loadHandler('write');
    
            if (!$object->isDirty()) {
    Severity: Minor
    Found in class/stats.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 loginregHistoryShow has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function loginregHistoryShow($args)
        {
            $criteria = new CriteriaCompo();
            $criteria->add(new Criteria('uid', 0), 'AND');
            $criteria->add(new Criteria('post', '%pass%', 'LIKE'), 'AND'); // login or register
    Severity: Minor
    Found in class/query.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 checkVerXoops has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
        {
            $moduleDirName = basename(dirname(__DIR__));
            if (null === $module) {
                $module = XoopsModule::getByDirname($moduleDirName);
    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 userlog_views_edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function userlog_views_edit($options)
    {
        // require_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6
        xoops_load('XoopsFormLoader');
        // $form = new XoopsBlockForm(); //reserve for 2.6
    Severity: Major
    Found in blocks/views.php - About 2 hrs to fix

      UserlogLog has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class UserlogLog extends XoopsObject
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in class/log.php - About 2 hrs to fix

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

            protected function _getRemoteIniFile($url, $path)
            {
                // local and remote file are the same, no update possible
                if ($url == $path) {
                    return false;
        Severity: Minor
        Found in class/phpbrowscap/Browscap.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 loginregHistoryShow has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function loginregHistoryShow($args)
            {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('uid', 0), 'AND');
                $criteria->add(new Criteria('post', '%pass%', 'LIKE'), 'AND'); // login or register
        Severity: Major
        Found in class/query.php - About 2 hrs to fix

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

              public function getLogsCounts($criteria = null, $fields = null, $asObject = true, $id_as_key = true)
              {
                  if (is_array($fields) && count($fields) > 0) {
                      if (!in_array($this->keyName, $fields)) {
                          $fields[] = $this->keyName;
          Severity: Major
          Found in class/log.php - About 2 hrs to fix

            Function validate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function validate(elName, elType, prevent, disablecat, elMsg) {
                var i = 0;
                var el = document.getElementsByName(elName);
                var is_valid = true;
                switch (elType) {
            Severity: Major
            Found in assets/js/scripts.js - About 2 hrs to fix

              Function createCacheOldWay has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function createCacheOldWay($iniContent, $actLikeNewVersion = false)
                  {
                      $browsers = parse_ini_string($iniContent, true, INI_SCANNER_RAW);
              
                      if ($actLikeNewVersion) {
              Severity: Minor
              Found in class/phpbrowscap/Browscap.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 _pregUnQuote has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _pregUnQuote($pattern, $matches)
                  {
                      // list of escaped characters: http://www.php.net/manual/en/function.preg-quote.php
                      // to properly unescape '?' which was changed to '.', I replace '\.' (real dot) with '\?',
                      // then change '.' to '?' and then '\?' to '.'.
              Severity: Major
              Found in class/phpbrowscap/Browscap.php - About 2 hrs to fix

                Method createCacheOldWay has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function createCacheOldWay($iniContent, $actLikeNewVersion = false)
                    {
                        $browsers = parse_ini_string($iniContent, true, INI_SCANNER_RAW);
                
                        if ($actLikeNewVersion) {
                Severity: Major
                Found in class/phpbrowscap/Browscap.php - About 2 hrs to fix

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

                      public static function getPlugins($pluginName = 'system', $inactiveModules = false)
                      {
                          static $plugins = [];
                          if (!isset($plugins[$pluginName])) {
                              $plugins[$pluginName] = [];
                  Severity: Minor
                  Found in class/plugin/plugin.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 getSet has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getSet()
                      {
                          $options = '';
                          // if uid setting exist in File
                          $unique_uid = $this->userlog->getUser() ? $this->userlog->getUser()->getVar('uid') : 0;
                  Severity: Major
                  Found in class/setting.php - About 2 hrs to fix

                    Function getSet has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getSet()
                        {
                            $options = '';
                            // if uid setting exist in File
                            $unique_uid = $this->userlog->getUser() ? $this->userlog->getUser()->getVar('uid') : 0;
                    Severity: Minor
                    Found in class/setting.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 insertUpdate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function insertUpdate($object, $duplicate = [], $force = true)
                        {
                            $handler = $this->loadHandler('write');
                    
                            if (!$object->isDirty()) {
                    Severity: Minor
                    Found in class/stats.php - About 1 hr to fix

                      Method _getRemoteIniFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function _getRemoteIniFile($url, $path)
                          {
                              // local and remote file are the same, no update possible
                              if ($url == $path) {
                                  return false;
                      Severity: Minor
                      Found in class/phpbrowscap/Browscap.php - About 1 hr to fix

                        Method updateCache has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function updateCache()
                            {
                                $lockfile = $this->cacheDir . 'cache.lock';
                        
                                $lockRes = fopen($lockfile, 'w+');
                        Severity: Minor
                        Found in class/phpbrowscap/Browscap.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language