Showing 87 of 92 total issues
Function generate_html_fields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function generate_html_fields( $fields, $return_array = false ) {
if ( empty( $fields ) ) {
return false; }
$html_fields = 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
Function generate_attribute
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function generate_attribute( $field_name, $field, $field_id ) {
// pre_print($field);
$input_item = '';
foreach ( $field as $item_id => $item_val ) {
if ( $field['type'] == 'select' && ( $item_id == 'placeholder' || $item_id == 'type' ) ) {
- 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 check_db_status
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function check_db_status() {
global $wapg_current_db_version, $wpdb, $wapg_tables;
$get_installed_db_version = get_site_option( 'wapg_db_version' );
if ( empty( $get_installed_db_version ) ) {
self::on_activate();
File CsFormBuilder.php
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php namespace WooGateWayCoreLib\admin\builders;
/**
* From Builder
*
File CsWapgCoinCal.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace WooGateWayCoreLib\frontend\functions;
/**
Function import_coin_symbol
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function import_coin_symbol() {
global $wapg_current_db_version, $wpdb, $wapg_tables;
$CsAdminQuery = new CsAdminQuery();
- 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 on_activate
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function on_activate() {
global $wpdb, $wapg_tables;
$charset_collate = $wpdb->get_charset_collate();
$sqls = array(
Method order_summary
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function order_summary( $order ) {
$payment_details = cartFunctions::get_payment_info( $order->id );
if ( empty( $payment_details ) ) {
return;
}
Method get_coin_name
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_coin_name( $user_input ) {
$oc_type = $user_input['oc_type'];
if ( $oc_type == 1 ) {
$query = $user_input['query'];
if ( empty( $query ) ) {
Method generate_field
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generate_field( $field_name, $field, $field_id ) {
$input = '<div class="label"><label>';
$input .= $this->generate_title( $field );
$input .= '</label></div>';
$input .= '<div class="input-group">';
Method order_metabox_coin_details
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function order_metabox_coin_details( $post ) {
$order_id = isset( $post->ID ) ? $post->ID : Util::check_evil_script( $_GET['post'] );
$payment_details = cartFunctions::get_payment_info( $order_id );
?>
<table class="cs-coin-info">
Method process_payment
has 45 lines of code (exceeds 25 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'] );
Method _cs_wapg_custom_call
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _cs_wapg_custom_call() {
if ( ! isset( $_REQUEST['cs_token'] ) || false === check_ajax_referer( SECURE_AUTH_SALT, 'cs_token', false ) ) {
wp_send_json(
array(
Method load_jquery_typehead
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function load_jquery_typehead() {
?>
<script type="text/javascript">
jQuery(document).ready(function( $ ){
$.typeahead({
Method wapg_checkout_scripts
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function wapg_checkout_scripts() {
wp_enqueue_style(
'wapg-checkout',
CS_WAPG_PLUGIN_ASSET_URI . '/css/checkout.min.css',
Method special_discount_offer_box
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function special_discount_offer_box() {
$offers = CsAdminQuery::get_offers_info();
$settings = CsPaymentGateway::get_checkout_page_options();
if ( $offers ) {
?>
Function generate_hidden_div
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function generate_hidden_div( $field_name, $args, $fields_number ) {
$attributes = '';
if ( isset( $args['attributes'] ) ) {
foreach ( $args['attributes'] as $attr_key => $attr_val ) {
if ( $attr_key == 'id' ) {
- 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 get_coin_martket_price
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_coin_martket_price( $coin_slug, $coinType ) {
if ( $coinType == 1 ) {
$api_url = sprintf( $this->coinmarketstats_free_api_url, $coin_slug );
} elseif ( $coinType == 2 ) {
$api_url = sprintf( $this->coinmarketstats_api_url, $coin_slug );
Method poulate_the_data
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function poulate_the_data() {
global $wpdb, $wapg_tables;
$search = '';
if ( isset( $_GET['s'] ) && ! empty( $skey = $_GET['s'] ) ) {
$search = " where c.name like '%{$skey}%'";
Method column_offer_info
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function column_offer_info( $item ) {
if ( $item->offer_status > 0 ) {
?>
<table class="wp-list-table widefat fixed striped offer hidden">