Showing 87 of 92 total issues
Function generate_select_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function generate_select_field( $field_name, $field, $field_id ) {
$value = '';
if ( isset( $field['value'] ) && ! empty( $field['value'] ) ) {
$value = $field['value'];
unset( $field['value'] );
- 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
Method error_handler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function error_handler( $errno, $errstr, $errfile, $errline, $errcontext ) {
Function cs_dokan_withdrawl_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function cs_dokan_withdrawl_method( $methods ) {
global $wpdb, $wapg_tables;
$coins = $wpdb->get_results( "select * from {$wapg_tables['coins']} order by name desc" );
if ( $coins ) {
foreach ( $coins as $coin ) {
- 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
Function init_gateway
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function init_gateway() {
$CsNotice = self::$namespace . "\admin\\notices\\wapgAdminNotice";
if ( class_exists( 'WC_Payment_Gateway' ) ) {
self::set_constant( 'IS_WOOCOMMERCE_INSTALLED', true );
$CsAutoOrder = self::$namespace . "\\admin\\functions\\CsAutomaticOrderConfirmationSettings";
- 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
Function load_admin_settings_scripts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function load_admin_settings_scripts( $page_id ) {
global $altcoin_menu;
if ( isset( $altcoin_menu['add_new_coin'] ) && $page_id == $altcoin_menu['add_new_coin'] ) {
wp_enqueue_style( 'jquery-typehead', CS_WAPG_PLUGIN_ASSET_URI . 'plugins/jquery-typeahead/jquery.typeahead.min.css', false );
- 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
Function notice_html
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function notice_html( $notice ) {
$notice_class = '';
if ( isset( $notice['error'] ) && true === $notice['error'] ) {
$notice_class = 'error-notice';
} elseif ( isset( $notice['success'] ) && ( true === $notice['success'] || false === $notice['success'] ) ) {
- 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
Function customForm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function customForm( $refObj ) {
global $wp;
$active_coins = CsAdminQuery::get_coins( array( 'where' => ' c.status = 1 ' ) );
if ( empty( $active_coins ) ) {
- 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
Function cs_dokan_seller_active_withdrawl_methods
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function cs_dokan_seller_active_withdrawl_methods( $active_payment_methods, $vendor_id = 0 ) {
$vendor_id = $vendor_id ? $vendor_id : dokan_get_current_user_id();
$payment_methods = get_user_meta( $vendor_id, 'dokan_profile_settings' );
if ( isset( $payment_methods[0]['payment'] ) ) {
foreach ( $payment_methods[0]['payment'] as $payment_method => $item ) {
- 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
Function process_payment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process_payment( $order_id ) {
$order = wc_get_order( $order_id );
$payment_confirm = isset( $_POST['payment_confirm'] ) ? $this->validate_text_field( false, $_POST['payment_confirm'] ) : '';
$payment_info = $this->validate_text_field( false, $_POST['payment_info'] );
- 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
Function hasPaid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function hasPaid() {
$getSettings = get_option( self::$settings_key );
if ( $getSettings ) {
if ( isset( $getSettings['id'] ) && isset( $getSettings['cms_username'] ) && isset( $getSettings['cms_pass'] ) ) {
if ( $getSettings['id'] == md5( trim( $getSettings['cms_username'] ) . trim( $getSettings['cms_pass'] ) . 'paid' ) ) {
- 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
return array(
'error' => true,
'response' => __( 'Coin not found in the exchange portal! Please contact administration.', 'woo-altcoin-payment-gateway' ),
);
Avoid too many return
statements within this method. 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
return array(
'error' => true,
'response' => __( 'Probably this currency is out of the market & doesn\'t have any value! Contact administration for more information..', 'woo-altcoin-payment-gateway' ),
);
Avoid too many return
statements within this method. Open
return wp_send_json(
array(
'success' => false,
'response' => 'Please select "Payment Confirmation Type" at first!',
)
Avoid too many return
statements within this method. 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
return wp_send_json(
Util::notice_html(
array(
'success' => false,
'response' => $response_msg,
Avoid too many return
statements within this method. 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
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
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' ),
Avoid too many return
statements within this method. Open
return wp_send_json( $this->get_auto_order_coins_list() );