Showing 3,246 of 4,217 total issues

Function render_type_slide has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function render_type_slide($params = [])
    {
        $total_records = $params['total_records'];
        $per_page = $params['per_page'];
        $requested_page = $params['requested_page'];
Severity: Minor
Found in plugins/common/classes/common/yf_divide_pages.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 url_to_absolute has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function url_to_absolute($baseUrl, $relativeUrl)
    {
        // Remove several frag parts from URL
        if (substr_count($baseUrl, '#') > 1) {
            $baseUrl = substr($baseUrl, 0, strpos($baseUrl, '#', strpos($baseUrl, '#') + 1));
Severity: Minor
Found in plugins/common/classes/common/yf_url_to_absolute.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 split_url has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function split_url($url, $decode = false)
    {
        // Character sets from RFC3986.
        $xunressub = 'a-zA-Z\d\-._~\!$&\'()\[\]*+,;=\|';
        $xpchar = $xunressub . ':@%';
Severity: Minor
Found in plugins/common/classes/common/yf_url_to_absolute.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 _order_create has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function _order_create()
    {
        if (empty($_POST)) {
            return false;
        }
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop__order_create.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 24 (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 functions/yf_common_funcs.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

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

<?php

class yf_manage_shop_attributes
{
    public function attributes()

    Method start has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function start()
        {
            $main = main();
            if ( ! empty($this->_started) || $main->is_console() || conf('SESSION_OFF') || $this->OFF) {
                return false;
    Severity: Major
    Found in plugins/session/classes/yf_session.class.php - About 3 hrs to fix

      Method _transaction has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _transaction($options)
          {
              if ( ! $this->ENABLE) {
                  return  null;
              }
      Severity: Major
      Found in plugins/payment/classes/yf_payment_api__provider.class.php - About 3 hrs to fix

        Method create_table has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function create_table($table, $extra = [], &$error = false)
            {
                // Example callable: create_table($name, function($t) { $t->int('id', 10); });
                if (is_callable($extra)) {
                    if (strpos($table, '.') !== false) {
        Severity: Major
        Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 3 hrs to fix

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

          <?php
          
          _class('payment_api__provider_remote');
          
          class yf_payment_api__provider_bitcoin extends yf_payment_api__provider_remote
          Severity: Minor
          Found in plugins/payment/classes/yf_payment_api__provider_bitcoin.class.php - About 3 hrs to fix

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

            <?php
            
            /**
             * Ethereum API wrapper.
             */
            Severity: Minor
            Found in plugins/ethereum/classes/yf_wrapper_ethereum.class.php - About 3 hrs to fix

              File pack_zend.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              //-----------------------------------------------------------
              // settings
              //-----------------------------------------------------------
              Severity: Minor
              Found in .dev/useful/pack_zend.php - About 3 hrs to fix

                Method _api_Interkassa has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _api_Interkassa($title)
                    {
                        $php = '';
                        $api = _class('payment_api__provider_interkassa');
                        $methods = [
                Severity: Major
                Found in plugins/payment/modules/yf_payment_test.class.php - About 3 hrs to fix

                  Method _external_response has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _external_response()
                      {
                          $ip = common()->get_ip();
                          if ( ! in_array($ip, ['185.71.65.92', '185.71.65.189', '149.202.17.210'])) {
                              $this->external_response_errors[] = 'Invalid sender IP address ' . $ip;
                  Severity: Major
                  Found in plugins/payment/classes/yf_payment_api__provider_payeer.class.php - About 3 hrs to fix

                    Method split_url has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function split_url($url, $decode = false)
                        {
                            // Character sets from RFC3986.
                            $xunressub = 'a-zA-Z\d\-._~\!$&\'()\[\]*+,;=\|';
                            $xpchar = $xunressub . ':@%';
                    Severity: Major
                    Found in plugins/common/classes/common/yf_url_to_absolute.class.php - About 3 hrs to fix

                      Method product_details has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function product_details()
                          {
                              if ( ! $_GET['id']) {
                                  return is_redirect('./?object=shop');
                              }
                      Severity: Major
                      Found in plugins/shop/modules/shop/yf_shop_product_details.class.php - About 3 hrs to fix

                        File forum_posts.data.php has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        return [
                          22 => [
                            'id' => '22',
                        Severity: Minor
                        Found in .dev/install/installer_data/db_tables_ru/forum_posts.data.php - About 3 hrs to fix

                          Method _get_current_lang has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function _get_current_lang($force = false)
                              {
                                  $langs = $this->LANGUAGES ?: $this->_get_langs();
                          
                                  $FORCE_LOCALE = conf('FORCE_LOCALE');
                          Severity: Major
                          Found in plugins/locale/classes/yf_i18n.class.php - About 3 hrs to fix

                            Method _on_validate_ok has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function _on_validate_ok($params = [], $form = null)
                                {
                                    $p = $params ?: $_POST;
                                    $lang = $p['lang_to'];
                                    $lang_from = $p['lang_from'] ?: 'en';

                              Method currency_rates_current has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function currency_rates_current()
                                  {
                                      $result = [];
                                      $payment_api = _class('payment_api');
                                      // conversion UNT to UAH
                              Severity: Major
                              Found in plugins/payment/modules/yf_payment_test.class.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language