skyverge/wc-plugin-framework

View on GitHub

Showing 396 of 396 total issues

Function array_to_xml has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public static function array_to_xml( $xml_writer, $element_key, $element_value = array() ) {

        if ( is_array( $element_value ) ) {

            // handle attributes
Severity: Minor
Found in woocommerce/class-sv-wc-helper.php - About 5 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_gateway_not_configured_notices has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_gateway_not_configured_notices() {

        $is_enhanced_admin_available = SV_WC_Plugin_Compatibility::is_enhanced_admin_available();

        foreach ( $this->get_gateways() as $gateway ) {
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 5 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

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

#[\AllowDynamicProperties]
class SV_WC_Payment_Gateway_Payment_Token {


    /** @var string payment gateway token ID */

    Function add_subscriptions_details_to_order has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        public function add_subscriptions_details_to_order( $order, $gateway ) {
    
            if ( isset( $order->payment ) ) {
    
                // defaults

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

        public function customer_tokens_exporter( $email_address, $page ) {
    
            $data = array();
            $user = get_user_by( 'email', $email_address );
    
    
    Severity: Minor
    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php - About 5 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

    File class-sv-wc-payment-gateway-apple-pay.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * WooCommerce Payment Gateway Framework
     *
     * This source file is subject to the GNU General Public License v3.0

      File class-sv-wc-payment-gateway-integration-subscriptions.php has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * WooCommerce Payment Gateway Framework
       *
       * This source file is subject to the GNU General Public License v3.0

        SV_WC_Helper has 36 functions (exceeds 20 allowed). Consider refactoring.
        Open

        #[\AllowDynamicProperties]
        class SV_WC_Helper {
        
        
            /** encoding used for mb_*() string functions */
        Severity: Minor
        Found in woocommerce/class-sv-wc-helper.php - About 4 hrs to fix

          SV_WC_Payment_Gateway_Payment_Form has 36 functions (exceeds 20 allowed). Consider refactoring.
          Open

          #[\AllowDynamicProperties]
          class SV_WC_Payment_Gateway_Payment_Form extends Handlers\Script_Handler {
          
          
              /** @var \SV_WC_Payment_Gateway gateway for this payment form */

            File class-sv-wc-payment-gateway-my-payment-methods.php has 360 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * WooCommerce Payment Gateway Framework
             *
             * This source file is subject to the GNU General Public License v3.0

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

              #[\AllowDynamicProperties]
              class SV_WC_Payment_Gateway_Payment_Tokens_Handler {
              
              
                  /** @var string the gateway environment ID */

                File class-sv-wc-payment-gateway-hosted.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * WooCommerce Payment Gateway Framework
                 *
                 * This source file is subject to the GNU General Public License v3.0
                Severity: Minor
                Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 4 hrs to fix

                  Function get_order has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get_order( $order_id ) {
                  
                          $order = parent::get_order( $order_id );
                  
                          // payment info
                  Severity: Minor
                  Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 4 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 create_token has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function create_token( \WC_Order $order, $response = null, $environment_id = null ) {
                  
                          $gateway = $this->get_gateway();
                  
                          // default to current environment

                  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

                  SV_WP_Background_Job_Handler has 34 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  #[\AllowDynamicProperties]
                  abstract class SV_WP_Background_Job_Handler extends SV_WP_Async_Request {
                  
                  
                      /** @var string async request prefix */
                  Severity: Minor
                  Found in woocommerce/utilities/class-sv-wp-background-job-handler.php - About 4 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

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

                      Function load_framework_plugins has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function load_framework_plugins() {
                      
                              // first sort the registered plugins by framework version
                              usort( $this->registered_plugins, array( $this, 'compare_frameworks' ) );
                      
                      
                      Severity: Minor
                      Found in woocommerce/class-sv-wc-framework-bootstrap.php - About 4 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 process_release_payment has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function process_release_payment( $order ) {
                      
                              try {
                      
                                  // set order defaults

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

                          public function process_payment( $order_id ) {
                      
                              parent::process_payment( $order_id );
                      
                              /**
                      Severity: Minor
                      Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 4 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

                      SV_WC_Payment_Gateway_Apple_Pay has 33 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      #[\AllowDynamicProperties]
                      class SV_WC_Payment_Gateway_Apple_Pay extends Payment_Gateway\External_Checkout\External_Checkout {
                      
                      
                          /** @var SV_WC_Payment_Gateway_Apple_Pay_Admin the admin instance */
                        Severity
                        Category
                        Status
                        Source
                        Language