skyverge/wc-plugin-framework

View on GitHub
woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php

Summary

Maintainability
D
2 days
Test Coverage

Function process_capture_charge_bulk_order_action has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_capture_charge_bulk_order_action( $redirect_url = null, $action = '', $order_ids = [] ) {
        global $typenow;

        if ( SV_WC_Plugin_Compatibility::is_hpos_enabled() ) {
            if ( ! SV_WC_Order_Compatibility::is_orders_screen() ) {

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

    public function enqueue_scripts( $hook_suffix ) {
        global $post, $theorder;

        // Order screen assets
        if ( SV_WC_Order_Compatibility::is_order( $post ) || SV_WC_Order_Compatibility::is_order( $theorder ) ) {

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

    public function add_capture_button( $order ) {

        // only display the button for core orders
        if ( ! SV_WC_Order_Compatibility::is_order( $order ) ) {
            return;

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

    public function ajax_process_capture() {

        check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_capture_charge', 'nonce' );

        $gateway_id = SV_WC_Helper::get_requested_value( 'gateway_id' );

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

    public function maybe_add_capture_charge_bulk_order_action() {

        if ( ! current_user_can( 'edit_shop_orders' ) ) {
            return;
        }

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 add_capture_button has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function add_capture_button( $order ) {

        // only display the button for core orders
        if ( ! SV_WC_Order_Compatibility::is_order( $order ) ) {
            return;

    Method ajax_process_capture has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ajax_process_capture() {
    
            check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_capture_charge', 'nonce' );
    
            $gateway_id = SV_WC_Helper::get_requested_value( 'gateway_id' );

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

          public function process_capture_charge_bulk_order_action( $redirect_url = null, $action = '', $order_ids = [] ) {
              global $typenow;
      
              if ( SV_WC_Plugin_Compatibility::is_hpos_enabled() ) {
                  if ( ! SV_WC_Order_Compatibility::is_orders_screen() ) {

        Avoid too many return statements within this method.
        Open

                    return;

          Avoid too many return statements within this method.
          Open

                      return;

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

                public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
            
                    $this->plugin = $plugin;
            
                    add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

            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

            There are no issues that match your filters.

            Category
            Status