SV_WC_Payment_Gateway_My_Payment_Methods
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
#[\AllowDynamicProperties]
class SV_WC_Payment_Gateway_My_Payment_Methods extends Handlers\Script_Handler {
/** @var SV_WC_Payment_Gateway_Plugin */
File class-sv-wc-payment-gateway-my-payment-methods.php
has 360 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 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
Function is_logging_enabled
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function is_logging_enabled() {
$is_logging_enabled = parent::is_logging_enabled();
if ( ! $is_logging_enabled ) {
- 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 handle_payment_method_actions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function handle_payment_method_actions() {
$token = trim( SV_WC_Helper::get_requested_value( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-token' ) );
$action = SV_WC_Helper::get_requested_value( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-action' );
- 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 payment_token_deleted
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function payment_token_deleted( $core_token_id, $core_token ) {
$token_id = null;
// find out if the core token belongs to one of the gateways from this plugin
- 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 clear_payment_methods_transients
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function clear_payment_methods_transients( $token_id, $token ) {
foreach ( $this->get_plugin()->get_gateways() as $gateway ) {
if ( ! $gateway->is_available() || ! ( $gateway->supports_tokenization() && $gateway->tokenization_enabled() ) ) {
- 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 ajax_save_payment_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function ajax_save_payment_method() {
check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method', 'nonce' );
try {
- 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_token_by_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function get_token_by_id( $token_id ) {
$token = null;
foreach ( $this->get_plugin()->get_gateways() as $gateway ) {
- 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 supports_add_payment_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function supports_add_payment_method() {
foreach ( $this->get_plugin()->get_gateways() as $gateway ) {
if ( $gateway->is_direct_gateway() && $gateway->supports_add_payment_method() ) {
- 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"