core/frontend/functions/CsWapgAutoOrderConfirm.php
Method track_coin
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function track_coin( $raw_data ) {
global $woocommerce;
$raw_data = $raw_data['form_data'];
$data = array();
Function track_coin
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
public function track_coin( $raw_data ) {
global $woocommerce;
$raw_data = $raw_data['form_data'];
$data = array();
- Read upRead up
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
Open
return wp_send_json(
Util::notice_html(
array(
'error' => true,
'response' => isset( $response->response ) ? $response->response : $response->message,
Avoid too many return
statements within this method. Open
Open
return wp_send_json(
Util::notice_html(
array(
'success' => true,
'response' => __( 'Thank you! Transaction completed successfully. Your order is processing right now!', 'woo-altcoin-payment-gateway' ),
Avoid too many return
statements within this method. Open
Open
return wp_send_json(
Util::notice_html(
array(
'success' => false,
'response' => $response_msg,
Avoid too many return
statements within this method. Open
Open
return wp_send_json(
Util::notice_html(
array(
'error' => true,
'response' => __( 'Cart information not found! Please uninstall the this plugin and install a fresh copy then upgrade your WooCommerce store. ', 'woo-altcoin-payment-gateway' ),
Avoid too many return
statements within this method. Open
Open
return wp_send_json(
Util::notice_html(
array(
'success' => false,
// 'response' => __( 'Transaction on processing. Getting confirmation data..', 'woo-altcoin-payment-gateway' )
Avoid too many return
statements within this method. Open
Open
return wp_send_json(
Util::notice_html(
array(
'error' => true,
'response' => __( 'Unable to retrieve rest api data from server. Please make sure your server allow to call rest api.', 'woo-altcoin-payment-gateway' ),