Showing 4,217 of 4,217 total issues

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

    public function get_user_info()
    {
        if (DEBUG_MODE && $_GET['oauth_clean']) {
            $this->_storage_clean();
        }
Severity: Minor
Found in plugins/oauth/classes/oauth/yf_oauth_driver1.class.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 show_rss_page has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function show_rss_page($data = [], $params = [])
    {
        require_php_lib('yf_feedcreator');
        $rss = new UniversalFeedCreator();
        if ( ! isset($params['use_cached']) || ! empty($params['use_cached'])) {
Severity: Minor
Found in plugins/common/classes/common/yf_rss_data.class.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 _perm_str2num has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function _perm_str2num($perm = '')
    {
        $perm_len = strlen(trim($perm));
        if ($perm_len > 10 && $perm_len < 9) {
            return false;
Severity: Minor
Found in plugins/ssh/classes/yf_ssh.class.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 init_server_id has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function init_server_id()
    {
        $this->PROFILING && $this->_timing[] = [microtime(true), __CLASS__, __FUNCTION__, $this->trace_string(), func_get_args()];
        $servers = $this->get_data('servers');
        $this->SERVER_ID = 0;
Severity: Minor
Found in classes/yf_main.class.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 wordwrap has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function wordwrap($str, $width = 75, $break = "\n", $cut = false)
    {
        $splitedArray = [];
        $lines = explode("\n", $str);
        foreach ((array) $lines as $line) {
Severity: Minor
Found in classes/yf_utf8.class.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 show has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function show()
    {
        $id = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['id']);
        $method = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['page']);
        if (strlen($id)) {
Severity: Minor
Found in .dev/samples/classes/sample_form.class.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 my_array_merge has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function my_array_merge($a1, $a2)
    {
        foreach ((array) $a2 as $k => $v) {
            if (isset($a1[$k]) && is_array($a1[$k])) {
                if (is_array($a2[$k])) {
Severity: Minor
Found in .dev/install/skel_basic/config/project_conf.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 _external_response has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _external_response($options)
    {
        $pos_data = json_decode($options['posData'], true);
        $operation_id = (int) ($pos_data['orderId']);
        $ip = common()->get_ip();
Severity: Major
Found in plugins/payment/classes/yf_payment_api__provider_bitpay.class.php - About 3 hrs to fix

    File yf_form2_boxes.class.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    
    class yf_form2_boxes
    {
    Severity: Minor
    Found in plugins/form2/classes/form2/yf_form2_boxes.class.php - About 3 hrs to fix

      Method send has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function send($params = [])
          {
              $driver = strtolower($params['driver'] ?: $this->DRIVER);
              if (DEBUG_MODE || $this->LOG_EMAILS) {
                  $time_start = microtime(true);
      Severity: Major
      Found in plugins/email/classes/yf_send_mail.class.php - About 3 hrs to fix

        Method scan_dir has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function scan_dir($server_info = [], $start_dir = '', $pattern_include = '', $pattern_exclude = '', $level = 0, $single_file = '')
            {
                if (is_array($start_dir)) {
                    $_merged_contents = [];
                    foreach ((array) $start_dir as $_start_dir) {
        Severity: Major
        Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php - About 3 hrs to fix

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

              public static function setUpBeforeClass() : void
              {
                  self::$_bak['DB_DRIVER'] = self::$DB_DRIVER;
                  self::$DB_DRIVER = 'mysqli';
                  self::_connect();
          Severity: Major
          Found in .dev/tests/functional/model/class_model_bears_test.Test.php and 2 other locations - About 3 hrs to fix
          .dev/tests/functional/model/class_model_basic_test.Test.php on lines 18..31
          .dev/tests/functional/model/class_model_sakila_test.Test.php on lines 18..31

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

          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 3 locations. Consider refactoring.
          Open

              public static function setUpBeforeClass() : void
              {
                  self::$_bak['DB_DRIVER'] = self::$DB_DRIVER;
                  self::$DB_DRIVER = 'mysqli';
                  self::_connect();
          Severity: Major
          Found in .dev/tests/functional/model/class_model_basic_test.Test.php and 2 other locations - About 3 hrs to fix
          .dev/tests/functional/model/class_model_bears_test.Test.php on lines 18..31
          .dev/tests/functional/model/class_model_sakila_test.Test.php on lines 18..31

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

          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 3 locations. Consider refactoring.
          Open

              public static function setUpBeforeClass() : void
              {
                  self::$_bak['DB_DRIVER'] = self::$DB_DRIVER;
                  self::$DB_DRIVER = 'mysqli';
                  self::_connect();
          .dev/tests/functional/model/class_model_basic_test.Test.php on lines 18..31
          .dev/tests/functional/model/class_model_bears_test.Test.php on lines 18..31

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

          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

                  if (DEBUG_MODE) {
                      $exec_time = microtime(true) - $time_start;
                      $debug_info .= '<b>' . common()->_format_time_value($exec_time) . " sec</b>,\n";
                      $debug_info .= 'func: <b>' . __FUNCTION__ . '</b>, server: ' . $server_info['base_ip'] . ",\n";
                      $debug_info .= "local_file: \"<b style='color:blue;'>" . $local_file . '</b>"<br />';
          Severity: Major
          Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php and 1 other location - About 3 hrs to fix
          plugins/ssh/classes/ssh/yf_ssh_files.class.php on lines 51..59

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

          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

                  if (DEBUG_MODE) {
                      $exec_time = microtime(true) - $time_start;
                      $debug_info .= '<b>' . common()->_format_time_value($exec_time) . " sec</b>,\n";
                      $debug_info .= 'func: <b>' . __FUNCTION__ . '</b>, server: ' . $server_info['base_ip'] . ",\n";
                      $debug_info .= "remote_file: \"<b style='color:blue;'>" . $remote_file . '</b>"<br />';
          Severity: Major
          Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php and 1 other location - About 3 hrs to fix
          plugins/ssh/classes/ssh/yf_ssh_files.class.php on lines 108..116

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

          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

          return [
              'be' => 'BY',
              'bg' => 'BG',
              'cs' => 'CZ',
              'de' => 'DE',
          Severity: Major
          Found in plugins/locale/share/data_handlers/lang_def_country.php and 1 other location - About 3 hrs to fix
          .dev/scripts/languages/get_latest_languages.php on lines 38..70

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

          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

              $lang_to_country = [
                  'en' => 'us',
                  'ru' => 'ru',
                  'uk' => 'ua',
                  'be' => 'by',
          Severity: Major
          Found in .dev/scripts/languages/get_latest_languages.php and 1 other location - About 3 hrs to fix
          plugins/locale/share/data_handlers/lang_def_country.php on lines 3..34

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

          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 yf_redirect.class.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Redirects handler.
           *
          Severity: Minor
          Found in classes/yf_redirect.class.php - About 3 hrs to fix

            Method _api_response has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _api_response()
                {
                    if ( ! $this->ENABLE) {
                        return  null;
                    }
              Severity
              Category
              Status
              Source
              Language