Sorry, data for that comparison is no longer available.

woocommerce/woocommerce

View on GitHub
includes/admin/helper/class-wc-helper.php

Summary

Maintainability
F
1 wk
Test Coverage

File class-wc-helper.php has 1080 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce Admin Helper
 *
 * @package WooCommerce\Admin\Helper
Severity: Major
Found in includes/admin/helper/class-wc-helper.php - About 2 days to fix

    Method render_helper_output has 221 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function render_helper_output() {
            $auth           = WC_Helper_Options::get( 'auth' );
            $auth_user_data = WC_Helper_Options::get( 'auth_user_data' );
    
            // Return success/error notices.
    Severity: Major
    Found in includes/admin/helper/class-wc-helper.php - About 1 day to fix

      Function render_helper_output has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function render_helper_output() {
              $auth           = WC_Helper_Options::get( 'auth' );
              $auth_user_data = WC_Helper_Options::get( 'auth_user_data' );
      
              // Return success/error notices.
      Severity: Minor
      Found in includes/admin/helper/class-wc-helper.php - About 1 day 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

      WC_Helper has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class WC_Helper {
          /**
           * A log object returned by wc_get_logger().
           *
           * @var $log
      Severity: Minor
      Found in includes/admin/helper/class-wc-helper.php - About 4 hrs to fix

        Method _get_return_notices has 110 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function _get_return_notices() {
                $return_status = isset( $_GET['wc-helper-status'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-status'] ) ) : null;
                $notices       = array();
        
                switch ( $return_status ) {
        Severity: Major
        Found in includes/admin/helper/class-wc-helper.php - About 4 hrs to fix

          Method _helper_auth_return has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function _helper_auth_return() {
                  if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'connect' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                      self::log( 'Could not verify nonce in _helper_auth_return' );
                      wp_die( 'Something went wrong' );
                  }
          Severity: Major
          Found in includes/admin/helper/class-wc-helper.php - About 2 hrs to fix

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

                public static function get_local_woo_themes() {
                    $themes     = wp_get_themes();
                    $woo_themes = array();
            
                    foreach ( $themes as $theme ) {
            Severity: Minor
            Found in includes/admin/helper/class-wc-helper.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

            Method activated_plugin has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function activated_plugin( $filename ) {
                    $plugins = self::get_local_woo_plugins();
            
                    // Not a local woo plugin.
                    if ( empty( $plugins[ $filename ] ) ) {
            Severity: Major
            Found in includes/admin/helper/class-wc-helper.php - About 2 hrs to fix

              Function activated_plugin has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function activated_plugin( $filename ) {
                      $plugins = self::get_local_woo_plugins();
              
                      // Not a local woo plugin.
                      if ( empty( $plugins[ $filename ] ) ) {
              Severity: Minor
              Found in includes/admin/helper/class-wc-helper.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 get_local_woo_plugins has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function get_local_woo_plugins() {
                      if ( ! function_exists( 'get_plugins' ) ) {
                          require_once ABSPATH . 'wp-admin/includes/plugin.php';
                      }
              
              
              Severity: Minor
              Found in includes/admin/helper/class-wc-helper.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 _filter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function _filter( &$subscriptions, $filter ) {
                      switch ( $filter ) {
                          case 'active':
                              $subscriptions = wp_list_filter( $subscriptions, array( 'active' => true ) );
                              break;
              Severity: Minor
              Found in includes/admin/helper/class-wc-helper.php - About 1 hr 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 _helper_subscription_activate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function _helper_subscription_activate() {
                      $product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : '';
                      $product_id  = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
              
                      if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'activate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
              Severity: Minor
              Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                Method deactivated_plugin has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function deactivated_plugin( $filename ) {
                        $plugins = self::get_local_woo_plugins();
                
                        // Not a local woo plugin.
                        if ( empty( $plugins[ $filename ] ) ) {
                Severity: Minor
                Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                  Method _helper_auth_connect has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function _helper_auth_connect() {
                          if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'connect' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                              self::log( 'Could not verify nonce in _helper_auth_connect' );
                              wp_die( 'Could not verify nonce' );
                          }
                  Severity: Minor
                  Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                    Method _helper_subscription_deactivate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function _helper_subscription_deactivate() {
                            $product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : '';
                            $product_id  = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                    
                            if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'deactivate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                    Severity: Minor
                    Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

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

                          public static function get_local_woo_plugins() {
                              if ( ! function_exists( 'get_plugins' ) ) {
                                  require_once ABSPATH . 'wp-admin/includes/plugin.php';
                              }
                      
                      
                      Severity: Minor
                      Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                        Function _get_return_notices has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static function _get_return_notices() {
                                $return_status = isset( $_GET['wc-helper-status'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-status'] ) ) : null;
                                $notices       = array();
                        
                                switch ( $return_status ) {
                        Severity: Minor
                        Found in includes/admin/helper/class-wc-helper.php - About 1 hr 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 _helper_plugin_deactivate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function _helper_plugin_deactivate() {
                                $product_id  = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                $deactivated = false;
                        
                                if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'deactivate-plugin:' . $product_id ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                        Severity: Minor
                        Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                          Method get_local_woo_themes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function get_local_woo_themes() {
                                  $themes     = wp_get_themes();
                                  $woo_themes = array();
                          
                                  foreach ( $themes as $theme ) {
                          Severity: Minor
                          Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                            Function deactivated_plugin has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function deactivated_plugin( $filename ) {
                                    $plugins = self::get_local_woo_plugins();
                            
                                    // Not a local woo plugin.
                                    if ( empty( $plugins[ $filename ] ) ) {
                            Severity: Minor
                            Found in includes/admin/helper/class-wc-helper.php - About 1 hr 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 _filter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function _filter( &$subscriptions, $filter ) {
                                    switch ( $filter ) {
                                        case 'active':
                                            $subscriptions = wp_list_filter( $subscriptions, array( 'active' => true ) );
                                            break;
                            Severity: Minor
                            Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                              Method current_screen has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function current_screen( $screen ) {
                                      $wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
                              
                                      if ( $wc_screen_id . '_page_wc-addons' !== $screen->id ) {
                                          return;
                              Severity: Minor
                              Found in includes/admin/helper/class-wc-helper.php - About 1 hr to fix

                                Function current_screen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function current_screen( $screen ) {
                                        $wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
                                
                                        if ( $wc_screen_id . '_page_wc-addons' !== $screen->id ) {
                                            return;
                                Severity: Minor
                                Found in includes/admin/helper/class-wc-helper.php - About 1 hr 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 _helper_auth_return has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private static function _helper_auth_return() {
                                        if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'connect' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                                            self::log( 'Could not verify nonce in _helper_auth_return' );
                                            wp_die( 'Something went wrong' );
                                        }
                                Severity: Minor
                                Found in includes/admin/helper/class-wc-helper.php - About 55 mins 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 _helper_subscription_activate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private static function _helper_subscription_activate() {
                                        $product_key = isset( $_GET['wc-helper-product-key'] ) ? wc_clean( wp_unslash( $_GET['wc-helper-product-key'] ) ) : '';
                                        $product_id  = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                
                                        if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'activate:' . $product_key ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                                Severity: Minor
                                Found in includes/admin/helper/class-wc-helper.php - About 35 mins 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 _get_extensions_update_notice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private static function _get_extensions_update_notice() {
                                        $plugins   = self::get_local_woo_plugins();
                                        $updates   = WC_Helper_Updater::get_update_data();
                                        $available = 0;
                                
                                
                                Severity: Minor
                                Found in includes/admin/helper/class-wc-helper.php - About 35 mins 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

                                Avoid too many return statements within this method.
                                Open

                                            return self::_helper_subscription_activate();
                                Severity: Major
                                Found in includes/admin/helper/class-wc-helper.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return self::_helper_plugin_deactivate();
                                  Severity: Major
                                  Found in includes/admin/helper/class-wc-helper.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return self::_helper_auth_disconnect();
                                    Severity: Major
                                    Found in includes/admin/helper/class-wc-helper.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return self::_helper_subscription_deactivate();
                                      Severity: Major
                                      Found in includes/admin/helper/class-wc-helper.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return self::_helper_auth_refresh();
                                        Severity: Major
                                        Found in includes/admin/helper/class-wc-helper.php - About 30 mins to fix

                                          Function _helper_plugin_deactivate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              private static function _helper_plugin_deactivate() {
                                                  $product_id  = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                                  $deactivated = false;
                                          
                                                  if ( empty( $_GET['wc-helper-nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['wc-helper-nonce'] ), 'deactivate-plugin:' . $product_id ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
                                          Severity: Minor
                                          Found in includes/admin/helper/class-wc-helper.php - About 25 mins 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

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

                                              public static function get_filters() {
                                                  $filters = array(
                                                      'all'              => __( 'All', 'woocommerce' ),
                                                      'active'           => __( 'Active', 'woocommerce' ),
                                                      'inactive'         => __( 'Inactive', 'woocommerce' ),
                                          Severity: Major
                                          Found in includes/admin/helper/class-wc-helper.php and 1 other location - About 2 hrs to fix
                                          includes/admin/reports/class-wc-report-customer-list.php on lines 213..226

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

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

                                                      case 'deactivate-plugin-success':
                                                          $product_id   = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                                          $subscription = self::_get_subscriptions_from_product_id( $product_id );
                                                          $notices[]    = array(
                                                              'type'    => 'updated',
                                          Severity: Major
                                          Found in includes/admin/helper/class-wc-helper.php and 3 other locations - About 1 hr to fix
                                          includes/admin/helper/class-wc-helper.php on lines 489..500
                                          includes/admin/helper/class-wc-helper.php on lines 502..513
                                          includes/admin/helper/class-wc-helper.php on lines 553..564

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

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

                                                      case 'activate-success':
                                                          $product_id   = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                                          $subscription = self::_get_subscriptions_from_product_id( $product_id );
                                                          $notices[]    = array(
                                                              'type'    => 'updated',
                                          Severity: Major
                                          Found in includes/admin/helper/class-wc-helper.php and 3 other locations - About 1 hr to fix
                                          includes/admin/helper/class-wc-helper.php on lines 502..513
                                          includes/admin/helper/class-wc-helper.php on lines 553..564
                                          includes/admin/helper/class-wc-helper.php on lines 566..577

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

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

                                                      case 'deactivate-error':
                                                          $product_id   = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                                          $subscription = self::_get_subscriptions_from_product_id( $product_id );
                                                          $notices[]    = array(
                                                              'type'    => 'error',
                                          Severity: Major
                                          Found in includes/admin/helper/class-wc-helper.php and 3 other locations - About 1 hr to fix
                                          includes/admin/helper/class-wc-helper.php on lines 489..500
                                          includes/admin/helper/class-wc-helper.php on lines 502..513
                                          includes/admin/helper/class-wc-helper.php on lines 566..577

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

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

                                                      case 'activate-error':
                                                          $product_id   = isset( $_GET['wc-helper-product-id'] ) ? absint( $_GET['wc-helper-product-id'] ) : 0;
                                                          $subscription = self::_get_subscriptions_from_product_id( $product_id );
                                                          $notices[]    = array(
                                                              'type'    => 'error',
                                          Severity: Major
                                          Found in includes/admin/helper/class-wc-helper.php and 3 other locations - About 1 hr to fix
                                          includes/admin/helper/class-wc-helper.php on lines 489..500
                                          includes/admin/helper/class-wc-helper.php on lines 553..564
                                          includes/admin/helper/class-wc-helper.php on lines 566..577

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

                                          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