XoopsModules25x/userlog

View on GitHub

Showing 113 of 1,244 total issues

Function getOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function getOptions($option = null, $V = 'value')
    {
        $V = strtolower($V);

        if ($this->userlog->getUser()) {
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

Function storeDb has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function storeDb($tolog, $force = true)
    {
        // set vars
        foreach ($tolog as $option => $logvalue) {
            if (!empty($logvalue)) {
Severity: Minor
Found in class/log.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 storeFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function storeFile($tolog)
    {
        $log_file = $this->userlog->getWorkingFile();
        // file create/open/write
        $fileHandler = XoopsFile::getHandler();
Severity: Minor
Found in class/log.php - About 1 hr to fix

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

        public function loginregHistoryForm($args, $eleNamePrefix = 'options')
        {
            // require_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6
            xoops_load('XoopsFormLoader');
            // $form = new XoopsBlockForm(); //reserve for 2.6
    Severity: Minor
    Found in class/query.php - About 1 hr to fix

      Method checkVerXoops has 34 lines of code (exceeds 25 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 1 hr to fix

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

            public function mergeFiles($log_files = [], $mergeFileName = null)
            {
                $log_files = $this->parseFiles($log_files);
                if (0 == ($totalFiles = count($log_files))) {
                    $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
        Severity: Minor
        Found in class/log.php - About 1 hr to fix

          Method getAll has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAll(
                  $type = [],
                  $start = 0,
                  $limit = 0,
                  $sort = 'stats_value',
          Severity: Minor
          Found in class/stats.php - About 1 hr to fix

            Method logForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function logForm($options = null)
                {
                    $form    = new XoopsThemeForm(_AM_USERLOG_LOGFORM, 'logs', 'logs.php', 'get');
                    $headers = $this->getOptions('', 'title');
                    unset($headers['active'], $headers['inside'], $headers['outside'], $headers['unset_pass'], $headers['store_db'], $headers['store_file'], $headers['views']);
            Severity: Minor
            Found in class/setting.php - About 1 hr to fix

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

                  public function getAll(
                      $type = [],
                      $start = 0,
                      $limit = 0,
                      $sort = 'stats_value',
              Severity: Minor
              Found in class/stats.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 _array2string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _array2string($array)
                  {
                      $content = "array(\n";
              
                      foreach ($array as $key => $value) {
              Severity: Minor
              Found in class/phpbrowscap/Browscap.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 storeFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function storeFile($tolog)
                  {
                      $log_file = $this->userlog->getWorkingFile();
                      // file create/open/write
                      $fileHandler = XoopsFile::getHandler();
              Severity: Minor
              Found in class/log.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 arrayToDisplay has 31 lines of code (exceeds 25 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 1 hr to fix

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

                    public function stats_typeForm($args, $eleNamePrefix = 'options')
                    {
                        // require_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6
                        xoops_load('XoopsFormLoader');
                        // $form = new XoopsBlockForm(); //reserve for 2.6
                Severity: Minor
                Found in class/query.php - About 1 hr to fix

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

                      public function zipFiles($log_files = [], $zipFileName = null)
                      {
                          $log_files = $this->parseFiles($log_files);
                          if (0 == ($totalFiles = count($log_files))) {
                              $this->setErrors('No file to zip');
                  Severity: Minor
                  Found in class/log.php - About 1 hr to fix

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

                        public function __construct()
                        {
                            $this->userlog = Userlog::getInstance();
                            $this->initVar('log_id', XOBJ_DTYPE_INT, null, false);
                            $this->initVar('log_time', XOBJ_DTYPE_INT, null, true);
                    Severity: Minor
                    Found in class/log.php - About 1 hr to fix

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

                          public function item($subscribe_from)
                          {
                              if (empty($subscribe_from)) {
                                  $script_arr             = [];
                                  $script_arr['topic_id'] = ['viewtopic.php'];
                      Severity: Minor
                      Found in class/plugin/newbb.php - About 1 hr to fix

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

                            public function setItem()
                            {
                                // In very rare occasions like newbb the item_id is not in the URL $_REQUEST
                                require_once __DIR__ . '/plugin/plugin.php';
                                require_once __DIR__ . '/plugin/Abstract.php';
                        Severity: Minor
                        Found in class/log.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 patchLoginHistory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function patchLoginHistory($post = null, $uid = 0, $unsetPass = true)
                            {
                                if ($uid > 0 || empty($post['pass']) || empty($post['uname'])) {
                                    return $post;
                                }
                        Severity: Minor
                        Found in class/helper.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 copyFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function copyFile($log_file = null, $newFileName = null)
                            {
                                if (!is_string($log_file)) {
                                    $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
                        
                        
                        Severity: Minor
                        Found in class/log.php - About 1 hr to fix

                          Method renameFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function renameFile($log_file = null, $newFileName = null)
                              {
                                  if (!is_string($log_file)) {
                                      $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
                          
                          
                          Severity: Minor
                          Found in class/log.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language