Showing 4,217 of 4,217 total issues

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

    public function price($name, $desc = '', $extra = [], $replace = [])
    {
        if (is_array($desc)) {
            $extra = (array) $extra + $desc;
            $desc = '';
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
plugins/form2/classes/yf_form2.class.php on lines 1480..1491

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

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 decimal($name, $desc = '', $extra = [], $replace = [])
    {
        if (is_array($desc)) {
            $extra = (array) $extra + $desc;
            $desc = '';
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 1 hr to fix
plugins/form2/classes/yf_form2.class.php on lines 1520..1531

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

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

function _basic_auth_check($users = [])
{
    $auth_user = trim($_SERVER['PHP_AUTH_USER']);
    $auth_pswd = trim($_SERVER['PHP_AUTH_PW']);
    if ( ! strlen($auth_user) || ! strlen($auth_pswd)) {
Severity: Major
Found in functions/yf_basic_auth.php and 1 other location - About 1 hr to fix
functions/yf_debug.php on lines 72..85

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

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

function _debug_auth_check($users = [])
{
    $auth_user = trim($_SERVER['PHP_AUTH_USER']);
    $auth_pswd = trim($_SERVER['PHP_AUTH_PW']);
    if ( ! strlen($auth_user) || ! strlen($auth_pswd)) {
Severity: Major
Found in functions/yf_debug.php and 1 other location - About 1 hr to fix
functions/yf_basic_auth.php on lines 32..45

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

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 a has 47 lines of code (exceeds 25 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 1 hr to fix

    Method load__cashex_xml has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function load__cashex_xml($options = null)
        {
            // import options
            is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
            // var
    Severity: Minor
    Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 1 hr to fix

      Method _form_options has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

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

          Method active has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function active($params = [])
              {
                  if (is_string($params)) {
                      $params = [
                          'table' => $params,
          Severity: Minor
          Found in plugins/sys/classes/yf_admin_methods.class.php - About 1 hr to fix

            Method _check_payout_operation has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _check_payout_operation($operation_id)
                {
                    $payment_api = &$this->payment_api;
                    $operation = $payment_api->operation(['operation_id' => $operation_id]);
                    $address = $operation['options']['request'][0]['options']['address'] ?: false;
            Severity: Minor
            Found in plugins/payment/classes/yf_payment_api__provider_bitaps.class.php - About 1 hr to fix

              Method _save_login_in_session has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _save_login_in_session($user_info = [], $no_redirect_on_success = false)
                  {
                      if (empty($user_info['id'])) {
                          return js_redirect($this->URL_WRONG_LOGIN);
                      } elseif ($this->_is_user_inactive($user_info)) {
              Severity: Minor
              Found in plugins/auth/classes/auth/yf_auth_user.class.php - About 1 hr to fix

                Method save has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function save(array $params = [])
                    {
                        // Try to get user error message source
                        $backtrace = debug_backtrace();
                        $cur_trace = $backtrace[2];
                Severity: Minor
                Found in plugins/email/classes/mail/yf_mail_log.class.php - About 1 hr to fix

                  Method create_trigger has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function create_trigger($name, $table, $trigger_time, $trigger_event, $trigger_body, $extra = [], &$error = false)
                      {
                          if (strpos($name, '.') !== false) {
                              list($db_name, $name) = explode('.', trim($name));
                          }
                  Severity: Minor
                  Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 1 hr to fix

                    Method multi_get has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function multi_get($names = [], $force_ttl = 0, $params = [])
                        {
                            $do_real_work = true;
                            if ( ! $this->_driver_ok || $this->NO_CACHE) {
                                $do_real_work = false;
                    Severity: Minor
                    Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

                      Method footer_link has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function footer_link($name, $link, $extra = [])
                          {
                              $item = [
                                  'type' => __FUNCTION__,
                                  'name' => $name,
                      Severity: Minor
                      Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                        Method query_fetch_all has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function query_fetch_all($sql, $key_name = null, $use_cache = true)
                            {
                                if ( ! strlen($sql)) {
                                    return false;
                                }
                        Severity: Minor
                        Found in plugins/db/classes/yf_db.class.php - About 1 hr to fix

                          Method manufacturer_add has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function manufacturer_add()
                              {
                                  if (main()->is_post()) {
                                      if ( ! $_POST['name']) {
                                          _re('Product name must be filled');

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

                                public function _init()
                                {
                                    $supplier = db()->get('SELECT supplier_id, main_cat_id FROM ' . db('shop_admin_to_supplier') . ' WHERE admin_id=' . (int) (main()->ADMIN_ID));
                                    if ($supplier['supplier_id']) {
                                        $this->SUPPLIER_ID = $supplier['supplier_id'];
                            Severity: Minor
                            Found in plugins/shop/admin_modules/yf_manage_shop.class.php - About 1 hr to fix

                              Method log_error has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function log_error($params = [])
                                  {
                                      if ( ! $this->LOG_ERRORS) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in classes/yf_csrf_guard.class.php - About 1 hr to fix

                                Method test_select_complex has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function test_select_complex()
                                    {
                                        if ($this->_need_skip_test(__FUNCTION__)) {
                                            return;
                                        }
                                Severity: Minor
                                Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language