Function output_fields
has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring. Open
public static function output_fields( $options ) {
foreach ( $options as $value ) {
if ( ! isset( $value['type'] ) ) {
continue;
}
- 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 output_fields
has 417 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output_fields( $options ) {
foreach ( $options as $value ) {
if ( ! isset( $value['type'] ) ) {
continue;
}
File class-wc-admin-settings.php
has 663 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Admin Settings Class
*
* @package WooCommerce\Admin
Function save_fields
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public static function save_fields( $options, $data = null ) {
if ( is_null( $data ) ) {
$data = $_POST; // WPCS: input var okay, CSRF ok.
}
if ( empty( $data ) ) {
- 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 save_fields
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function save_fields( $options, $data = null ) {
if ( is_null( $data ) ) {
$data = $_POST; // WPCS: input var okay, CSRF ok.
}
if ( empty( $data ) ) {
Function get_option
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function get_option( $option_name, $default = '' ) {
if ( ! $option_name ) {
return $default;
}
- 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 check_download_folder_protection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function check_download_folder_protection() {
$upload_dir = wp_get_upload_dir();
$downloads_path = $upload_dir['basedir'] . '/woocommerce_uploads';
$download_method = get_option( 'woocommerce_file_download_method' );
$file_path = $downloads_path . '/.htaccess';
- 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_field_description
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function get_field_description( $value ) {
$description = '';
$tooltip_html = '';
if ( true === $value['desc_tip'] ) {
- 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_field_description
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_field_description( $value ) {
$description = '';
$tooltip_html = '';
if ( true === $value['desc_tip'] ) {
Function show_messages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function show_messages() {
if ( count( self::$errors ) > 0 ) {
foreach ( self::$errors as $error ) {
echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>';
}
- 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"