lucliscio/fanKounter

View on GitHub

Showing 79 of 86 total issues

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

<?php 
/* 
 * lan.inc.php
 *                                       __       HZKnight free PHP Scripts    _    vs 5.1
 *                                      / _| __ _ _ __   /\ /\___  _   _ _ __ | |_ ___ _ __
Severity: Major
Found in src/i18n/en.inc.php and 1 other location - About 1 wk to fix
src/i18n/it.inc.php on lines 1..210

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 1627.

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

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

<?php 
/* 
 * lan.inc.php
 *                                       __       HZKnight free PHP Scripts    _    vs 5.1
 *                                      / _| __ _ _ __   /\ /\___  _   _ _ __ | |_ ___ _ __
Severity: Major
Found in src/i18n/it.inc.php and 1 other location - About 1 wk to fix
src/i18n/en.inc.php on lines 1..210

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 1627.

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

File Browscap.php has 811 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace phpbrowscap;

/**
Severity: Major
Found in src/libs/Browscap.php - About 1 day to fix

    File ua-parser.js has 665 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /////////////////////////////////////////////////////////////////////////////////
    /* UAParser.js v1.0.32
       Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
       MIT License *//*
       Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
    Severity: Major
    Found in src/libs/js/ua-parser.js - About 1 day to fix

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

              public static function v3($namespace, $name)
              {
                  if(!self::is_valid($namespace)) return false;
      
                  // Get hexadecimal components of namespace
      Severity: Major
      Found in src/libs/UUID.class.php and 1 other location - About 1 day to fix
      src/libs/UUID.class.php on lines 108..147

      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 271.

      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

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

              public static function v5($namespace, $name) 
              {
                  if(!self::is_valid($namespace)) return false;
      
                  // Get hexadecimal components of namespace
      Severity: Major
      Found in src/libs/UUID.class.php and 1 other location - About 1 day to fix
      src/libs/UUID.class.php on lines 27..66

      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 271.

      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

      Function getBrowser has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getBrowser($user_agent = null, $return_array = false)
          {
              if ($this->shouldCacheBeUpdated()) {
                  try {
                      $this->updateCache();
      Severity: Minor
      Found in src/libs/Browscap.php - About 7 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

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

                                  if( $function_var ){
                                      
                                          // check if there's a function or a static method and separate, function by parameters
                                          $function_var = str_replace("::", "@double_dot@", $function_var );
      
      Severity: Major
      Found in src/libs/rain.tpl.class.php and 1 other location - About 4 hrs to fix
      src/libs/rain.tpl.class.php on lines 714..742

      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 175.

      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

                  if( $function_var ){
                      
                      // check if there's a function or a static method and separate, function by parameters
                      $function_var = str_replace("::", "@double_dot@", $function_var );
      
      Severity: Major
      Found in src/libs/rain.tpl.class.php and 1 other location - About 4 hrs to fix
      src/libs/rain.tpl.class.php on lines 816..843

      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 175.

      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 createCacheNewWay has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function createCacheNewWay($iniContent)
          {
              $patternPositions = array();
      
              // get all patterns from the ini file in the correct order,
      Severity: Major
      Found in src/libs/Browscap.php - About 4 hrs to fix

        Function createCacheNewWay has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function createCacheNewWay($iniContent)
            {
                $patternPositions = array();
        
                // get all patterns from the ini file in the correct order,
        Severity: Minor
        Found in src/libs/Browscap.php - About 4 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

        File counter.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php 
        /* 
         * counter.php
         *                                       __       HZKnight free PHP Scripts    _    vs 5.1
         *                                      / _| __ _ _ __   /\ /\___  _   _ _ __ | |_ ___ _ __
        Severity: Minor
        Found in src/counter.php - About 3 hrs to fix

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

           public function __construct($__url){
            settype($__url,"string");
          
            global $inf__engine,$inf__keyban;
          
          Severity: Minor
          Found in src/url.inc.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 _getRemoteData has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _getRemoteData($url)
              {
                  ini_set('user_agent', $this->_getUserAgent());
          
                  switch ($this->_getUpdateMethod()) {
          Severity: Minor
          Found in src/libs/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 87 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 src/libs/Browscap.php - About 3 hrs to fix

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

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

              Method _getRemoteData has 82 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 src/libs/Browscap.php - About 3 hrs to fix

                Method _panel1_ has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function _panel1_(){
                    global $cnf__last_entries;
                    global $dat__entry;
                    global $inf__country;
                
                
                Severity: Major
                Found in src/stats.php - About 3 hrs to fix

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

                   public function URL($__url){
                    settype($__url,"string");
                  
                    $__url_v=array("prot"=>"","host"=>"","port"=>"","path"=>"","page"=>"","para"=>"");
                  
                  Severity: Minor
                  Found in src/url.inc.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 _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 src/libs/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

                  Severity
                  Category
                  Status
                  Source
                  Language