Showing 376 of 396 total issues
SV_WC_Payment_Gateway_Hosted
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
#[\AllowDynamicProperties]
abstract class SV_WC_Payment_Gateway_Hosted extends SV_WC_Payment_Gateway {
/** @var string the WC API url, used for the IPN and/or redirect-back handler */
Function do_transaction
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function do_transaction( $order ) {
// perform the credit card or check transaction
if ( $this->is_credit_card_gateway() ) {
$response = $this->do_credit_card_transaction( $order );
- 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 render_select2_ajax
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function render_select2_ajax() {
if ( ! did_action( 'sv_wc_select2_ajax_rendered' ) ) {
$javascript = "( function(){
File class-sv-wc-payment-gateway-admin-payment-token-editor.php
has 326 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
Function process_job
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function process_job( $job, $items_per_batch = null ) {
if ( ! $this->start_time ) {
$this->start_time = time();
}
- 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 update_transaction_payment_method
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function update_transaction_payment_method( \WC_Order $order ) {
$token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), $order->payment->token );
$address = new Addresses\Customer_Address();
$address->set_from_order( $order );
- 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 __construct
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $id, $plugin, $args ) {
// first setup the gateway and payment type for this gateway
$this->payment_type = isset( $args['payment_type'] ) ? $args['payment_type'] : self::PAYMENT_TYPE_CREDIT_CARD;
- 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 get_user_message
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function get_user_message( $message_id ) {
$message = null;
switch ( $message_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
File sv-wc-payment-gateway-google-pay.js
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
jQuery( function( $ ) {
"use strict"
/**
Consider simplifying this complex logical expression. Open
if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_12_3\\SV_WC_Plugin_Compatibility' ) ) :
/**
* WooCommerce Compatibility Utility Class
Method get_item_schema
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => "{$this->settings->get_id()}_setting",
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() ) {
- 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 validate_check_fields
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_check_fields( $is_valid ) {
$account_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-number' );
$routing_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-routing-number' );
- 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 do_credit_card_transaction
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function do_credit_card_transaction( $order, $response = null ) {
if ( is_null( $response ) ) {
if ( $this->perform_credit_card_charge( $order ) ) {
$response = $this->get_api()->credit_card_charge( $order );
- 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_tokens
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function load_tokens() {
if ( ! empty( $this->tokens ) ) {
return $this->tokens;
}
- 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_tokens
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_tokens( $user_id, $args = array() ) {
// default to current environment
if ( ! isset( $args['environment_id'] ) ) {
$args['environment_id'] = $this->get_environment_id();
Function delete_token
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function delete_token( $user_id, SV_WC_Payment_Gateway_Payment_Token $token, $environment_id = null ) {
// default to current environment
if ( null === $environment_id ) {
$environment_id = $this->get_environment_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
Function process_transaction_response
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function process_transaction_response( FrameworkBase\SV_WC_Payment_Gateway_API_Response $response, \WC_Order $order ) {
// validate the response data such as order ID and payment status
$this->validate_transaction_response( $order, $response );
- 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
File Google_Pay.php
has 300 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
Function get_latest_wc_versions
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function get_latest_wc_versions() {
$latest_wc_versions = get_transient( 'sv_wc_plugin_wc_versions' );
if ( ! is_array( $latest_wc_versions ) ) {
- 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"