Showing 4,217 of 4,217 total issues

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

    public function tel($name = '', $desc = '', $extra = [], $replace = [])
    {
        if ( ! is_array($extra)) {
            $extra = [];
        }
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
plugins/form2/classes/yf_form2.class.php on lines 1568..1582
plugins/form2/classes/yf_form2.class.php on lines 1591..1605
plugins/form2/classes/yf_form2.class.php on lines 1614..1628
plugins/form2/classes/yf_form2.class.php on lines 1637..1651
plugins/form2/classes/yf_form2.class.php on lines 1660..1674
plugins/form2/classes/yf_form2.class.php on lines 1683..1697
plugins/form2/classes/yf_form2.class.php on lines 1706..1720

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

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

    public function _exec_method_on_action($action = 'login')
    {
        if ($action == 'login') {
            $callbacks = $this->EXEC_AFTER_LOGIN;
        } elseif ($action == 'logout') {
Severity: Major
Found in plugins/auth/classes/auth/yf_auth_user.class.php and 1 other location - About 2 hrs to fix
plugins/auth/classes/auth/yf_auth_admin.class.php on lines 392..409

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

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

        return form($replace)
            ->text('code')
            ->integer('user_id')
            ->integer('sum')
            ->select_box('status', $this->_statuses)
plugins/shop/admin_modules/manage_shop/yf_manage_shop_coupons.class.php on lines 87..96

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

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

    public function search($name = '', $desc = '', $extra = [], $replace = [])
    {
        if ( ! is_array($extra)) {
            $extra = [];
        }
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php and 7 other locations - About 2 hrs to fix
plugins/form2/classes/yf_form2.class.php on lines 1568..1582
plugins/form2/classes/yf_form2.class.php on lines 1591..1605
plugins/form2/classes/yf_form2.class.php on lines 1614..1628
plugins/form2/classes/yf_form2.class.php on lines 1637..1651
plugins/form2/classes/yf_form2.class.php on lines 1660..1674
plugins/form2/classes/yf_form2.class.php on lines 1683..1697
plugins/form2/classes/yf_form2.class.php on lines 1729..1743

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

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

    public function _exec_method_on_action($action = 'login')
    {
        if ($action == 'login') {
            $callbacks = $this->EXEC_AFTER_LOGIN;
        } elseif ($action == 'logout') {
Severity: Major
Found in plugins/auth/classes/auth/yf_auth_admin.class.php and 1 other location - About 2 hrs to fix
plugins/auth/classes/auth/yf_auth_user.class.php on lines 795..812

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

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 ( ! $shard_table_name && $this->SHARDING_BY_LANG) {
            $name = $table_name;
            $shard_lang = substr($name, -strlen('ru'));
            $has_divider = (substr($name, -strlen('_ru'), 1) === '_');
            if ($has_divider && preg_match('/[a-z]{2}/', $shard_lang)) {
Severity: Major
Found in plugins/db/classes/db/yf_db_installer.class.php and 1 other location - About 2 hrs to fix
plugins/db/classes/db/yf_db_installer.class.php on lines 296..303

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

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 function _strip_js_input($str)
    {
        // Extracting url from <script src="path.to/scripts.js"></script>
        $str = preg_replace_callback('~<script[\s]+[^>]*src=["\']([^"\']+?)["\'][^>]*>~ims', function ($m) {
            return $m[1];
Severity: Major
Found in plugins/assets/classes/yf_assets.class.php and 1 other location - About 2 hrs to fix
plugins/assets/classes/yf_assets.class.php on lines 2225..2240

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

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 function _strip_css_input($str)
    {
        // Extracting url from <link rel="stylesheet" href="path.to/style.css">
        $str = preg_replace_callback('~<link[\s]+[^>]*href=["\']([^"\']+?)["\'][^>]*>~ims', function ($m) {
            return $m[1];
Severity: Major
Found in plugins/assets/classes/yf_assets.class.php and 1 other location - About 2 hrs to fix
plugins/assets/classes/yf_assets.class.php on lines 2246..2261

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

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 ( ! $shard_table_name && $this->SHARDING_BY_COUNTRY) {
            $name = $table_name;
            $shard_country = substr($name, -strlen('es'));
            $has_divider = (substr($name, -strlen('_es'), 1) === '_');
            if ($has_divider && preg_match('/[a-z]{2}/', $shard_country)) {
Severity: Major
Found in plugins/db/classes/db/yf_db_installer.class.php and 1 other location - About 2 hrs to fix
plugins/db/classes/db/yf_db_installer.class.php on lines 287..294

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

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

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

    Method _payout_status_handler has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _payout_status_handler($options = null)
        {
            if ( ! $this->ENABLE) {
                return  null;
            }

      Method api_request has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function api_request($options = null)
          {
              if ( ! $this->ENABLE) {
                  return  null;
              }
      Severity: Major
      Found in plugins/payment/classes/yf_payment_api__provider_interkassa.class.php - About 2 hrs to fix

        Method show has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function show()
            {
                $quick_filter = $this->_show_quick_filter();
                return
                    '<div class="col-md-12">' .
        Severity: Major
        Found in plugins/admin/admin_modules/yf_admin.class.php - About 2 hrs to fix

          Method _init has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _init()
              {
                  $i_default = redis();
                  $i_cache = strpos(strtolower(cache()->DRIVER), 'redis') !== false ? cache()->_driver->_connection : null;
                  if (ini_get('session.save_handler') == 'redis' && preg_match('~tcp://(?P<host>[a-z0-9_-]+):(?P<port>[0-9]+)~ims', ini_get('session.save_path'), $m)) {
          Severity: Major
          Found in plugins/redis/admin_modules/yf_manage_redis.class.php - About 2 hrs to fix

            Method test_10 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function test_10()
                {
                    $this->assertEquals(
                        '<div class="bb_remote_image"><img src="http://www.google.com/intl/en_ALL/images/logo.gif"></div>',
                        self::_bbcode('[img]http://www.google.com/intl/en_ALL/images/logo.gif[/img]')
            Severity: Major
            Found in .dev/tests/unit/class_bb_codes_test.Test.php - About 2 hrs to fix

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

                  public function vars()
                  {
                      $vars = $this->_get_all_vars_from_files();
                      $vars_db = $this->_get_all_vars_from_db();
                      foreach ((array) $vars_db as $source => $a) {
              Severity: Minor
              Found in plugins/locale/admin_modules/yf_locale_editor.class.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 a has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function a()
                  {
                      $args = func_get_args();
                      $a = [];
                      // numerics params
              Severity: Minor
              Found in plugins/html/classes/yf_html.class.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 _city_select has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _city_select($params = [])
                  {
                      $STPL_NAME = 'register/city_select';
                      if ( ! empty($params['stpl_name'])) {
                          $STPL_NAME = $params['stpl_name'];
              Severity: Minor
              Found in plugins/geo/modules/yf_geo_content.class.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 validate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function validate($options)
                  {
                      // import options
                      is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                      // check payment method, type
              Severity: Minor
              Found in plugins/payment/classes/yf_payment_api__provider_remote.class.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 prepare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function prepare($options = null)
                  {
                      // import options
                      is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                      if (empty($_currency_rate)) {
              Severity: Minor
              Found in plugins/payment/classes/yf_payment_api__currency.class.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