connectors/class-connector-gravityforms.php

Summary

Maintainability
F
3 days
Test Coverage
F
0%

File class-connector-gravityforms.php has 569 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Connector for Gravity Forms
 *
 * @package WP_Stream
Severity: Major
Found in connectors/class-connector-gravityforms.php - About 1 day to fix

    Connector_GravityForms has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Connector_GravityForms extends Connector {
        /**
         * Connector slug
         *
         * @var string
    Severity: Minor
    Found in connectors/class-connector-gravityforms.php - About 5 hrs to fix

      Method action_links has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function action_links( $links, $record ) {
              if ( 'forms' === $record->context ) {
                  $links[ esc_html__( 'Edit', 'stream' ) ] = add_query_arg(
                      array(
                          'page' => 'gf_edit_forms',
      Severity: Minor
      Found in connectors/class-connector-gravityforms.php - About 1 hr to fix

        Method callback_gform_update_status has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function callback_gform_update_status( $lead_id, $status, $prev = '' ) {
                $lead = $this->get_lead( $lead_id );
                $form = $this->get_form( $lead['form_id'] );
        
                if ( 'active' === $status && 'trash' === $prev ) {
        Severity: Minor
        Found in connectors/class-connector-gravityforms.php - About 1 hr to fix

          Method log_form_action has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function log_form_action( $form_id, $action ) {
                  $form = $this->get_form( $form_id );
          
                  if ( empty( $form ) ) {
                      return;
          Severity: Minor
          Found in connectors/class-connector-gravityforms.php - About 1 hr to fix

            Method callback_gform_post_note_added has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function callback_gform_post_note_added( $note_id, $lead_id, $user_id, $user_name, $note, $note_type ) {
            Severity: Minor
            Found in connectors/class-connector-gravityforms.php - About 45 mins to fix

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

                  public function callback_gform_pre_notification_save( $notification, $form, $is_new = true ) {
                      if ( ! isset( $is_new ) ) {
                          $is_new = false;
                      }
              
              
              Severity: Major
              Found in connectors/class-connector-gravityforms.php and 1 other location - About 3 hrs to fix
              connectors/class-connector-gravityforms.php on lines 252..275

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

              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 callback_gform_pre_confirmation_save( $confirmation, $form, $is_new = true ) {
                      if ( ! isset( $is_new ) ) {
                          $is_new = false;
                      }
              
              
              Severity: Major
              Found in connectors/class-connector-gravityforms.php and 1 other location - About 3 hrs to fix
              connectors/class-connector-gravityforms.php on lines 285..308

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

              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 ( is_null( $this->options[ $option ] ) ) {
                          call_user_func( array( $this, 'check_' . str_replace( '-', '_', $option ) ), $old_value, $new_value );
                      } else {
                          $data         = $this->options[ $option ];
                          $option_title = $data['label'];
              Severity: Major
              Found in connectors/class-connector-gravityforms.php and 1 other location - About 1 hr to fix
              connectors/class-connector-edd.php on lines 332..348

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

              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

                      $actions = array(
                          'activated'     => esc_html__( 'Activated', 'stream' ),
                          'deactivated'   => esc_html__( 'Deactivated', 'stream' ),
                          'trashed'       => esc_html__( 'Trashed', 'stream' ),
                          'untrashed'     => esc_html__( 'Restored', 'stream' ),
              Severity: Major
              Found in connectors/class-connector-gravityforms.php and 1 other location - About 1 hr to fix
              connectors/class-connector-wordpress-seo.php on lines 244..252

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

              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 get_context_labels() {
                      return array(
                          'forms'    => esc_html_x( 'Forms', 'gravityforms', 'stream' ),
                          'settings' => esc_html_x( 'Settings', 'gravityforms', 'stream' ),
                          'export'   => esc_html_x( 'Import/Export', 'gravityforms', 'stream' ),
              Severity: Minor
              Found in connectors/class-connector-gravityforms.php and 1 other location - About 55 mins to fix
              connectors/class-connector-acf.php on lines 107..115

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

              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

              There are no issues that match your filters.

              Category
              Status