skyverge/wc-plugin-framework

View on GitHub

Showing 376 of 396 total issues

Method process_release_payment has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process_release_payment( $order ) {

        try {

            // set order defaults

    Method admin_options has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function admin_options() {
    
            parent::admin_options();
    
            ?>
    Severity: Major
    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 2 hrs to fix

      SV_WP_Admin_Message_Handler has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      #[\AllowDynamicProperties]
      class SV_WP_Admin_Message_Handler {
      
      
          /** transient message prefix */
      Severity: Minor
      Found in woocommerce/class-sv-wp-admin-message-handler.php - About 2 hrs to fix

        Function render_toggle_form_field has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render_toggle_form_field( $key, $args, $value ) {
        
                $args = wp_parse_args( $args, array(
                    'type'              => 'text',
                    'label'             => '',
        Severity: Minor
        Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 save has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save( $user_id ) {
        
                $tokens = ( isset( $_POST[ $this->get_input_name() ] ) ) ? $_POST[ $this->get_input_name() ] : [];
        
                $default_token_id = SV_WC_Helper::get_posted_value( $this->get_input_name() . '_default' );

        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 render_update_notices has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render_update_notices() {
        
                // must update plugin notice
                if ( ! empty( $this->incompatible_framework_plugins ) ) {
        
        
        Severity: Minor
        Found in woocommerce/class-sv-wc-framework-bootstrap.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 remove_order_personal_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function remove_order_personal_data( $order ) {
        
                $order = wc_get_order( $order );
        
                // ensure we have a full order object and it belongs to the plugin's gateway
        Severity: Minor
        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.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 get_credit_card_fields has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_credit_card_fields() {
        
                $defaults = $this->get_gateway()->get_payment_method_defaults();
        
                $fields = [

          Method perform_capture has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function perform_capture( \WC_Order $order, $amount = null ) {
          
                  $order = $this->get_gateway()->get_order_for_capture( $order, $amount );
          
                  try {
          Severity: Major
          Found in woocommerce/payment-gateway/Handlers/Capture.php - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

            if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_12_3\\SV_WC_Order_Compatibility' ) ) :
            
            
            /**
             * WooCommerce order compatibility class.
            Severity: Critical
            Found in woocommerce/compatibility/class-sv-wc-order-compatibility.php - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

              if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_12_3\\SV_WC_Payment_Gateway_Direct' ) ) :
              
              
              /**
               * # WooCommerce Payment Gateway Framework Direct Gateway
              Severity: Critical
              Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 2 hrs to fix

                Admin has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                #[\AllowDynamicProperties]
                abstract class Admin {
                
                
                    /** @var string settings section ID */
                Severity: Minor
                Found in woocommerce/payment-gateway/External_Checkout/Admin.php - About 2 hrs to fix

                  Google_Pay has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  #[\AllowDynamicProperties]
                  class Google_Pay extends External_Checkout {
                  
                  
                      /** @var Admin the admin instance */

                    Method __construct has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct( $id, $plugin, $args ) {
                    
                            // first setup the gateway and payment type for this gateway
                            $this->payment_type = isset( $args['payment_type'] ) ? $args['payment_type'] : self::PAYMENT_TYPE_CREDIT_CARD;
                    
                    
                    Severity: Major
                    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 2 hrs to fix

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

                          public function render_toggle_form_field( $key, $args, $value ) {
                      
                              $args = wp_parse_args( $args, array(
                                  'type'              => 'text',
                                  'label'             => '',
                      Severity: Major
                      Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 2 hrs to fix

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

                            protected function render_next_steps() {
                        
                                $next_steps         = $this->get_next_steps();
                                $additional_actions = $this->get_additional_actions();
                        
                        
                        Severity: Minor
                        Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 add_system_status_php_information has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function add_system_status_php_information( $rows ) {
                        
                                foreach ( $this->get_dependency_handler()->get_incompatible_php_settings() as $setting => $values ) {
                        
                                    if ( isset( $values['type'] ) && 'min' === $values['type'] ) {
                        Severity: Minor
                        Found in woocommerce/class-sv-wc-plugin.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 do_add_payment_method_transaction has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function do_add_payment_method_transaction( \WC_Order $order, SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
                        
                                if ( is_null( $response ) ) {
                                    $response = $this->get_api()->tokenize_payment_method( $order );
                                }
                        Severity: Minor
                        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.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_icon has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function get_icon() {
                        
                                $icon = '';
                        
                                // specific icon
                        Severity: Minor
                        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.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 save has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function save() {
                        
                                $token = $this->get_woocommerce_payment_token();
                        
                                if ( ! $token instanceof \WC_Payment_Token ) {

                        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