File abstract-sv-wc-plugin-admin-setup-wizard.php
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Plugin Framework
*
* This source file is subject to the GNU General Public License v3.0
Setup_Wizard
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
#[\AllowDynamicProperties]
abstract class Setup_Wizard {
/** the "finish" step ID */
Function render_toggle_form_field
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function render_toggle_form_field( $key, $args, $value ) {
$args = wp_parse_args( $args, array(
'type' => 'text',
'label' => '',
- 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_toggle_form_field
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render_toggle_form_field( $key, $args, $value ) {
$args = wp_parse_args( $args, array(
'type' => 'text',
'label' => '',
Function render_next_steps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function render_next_steps() {
$next_steps = $this->get_next_steps();
$additional_actions = $this->get_additional_actions();
- 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_next_steps
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function render_next_steps() {
$next_steps = $this->get_next_steps();
$additional_actions = $this->get_additional_actions();
Function __construct
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( Framework\SV_WC_Plugin $plugin ) {
// sanity check for admin and permissions
if ( ! is_admin() || ! current_user_can( $this->required_capability ) ) {
return;
- 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 register_step
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function register_step( $id, $name, $view_callback, $save_callback = null ) {
try {
// invalid 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 render_form_field
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function render_form_field( $key, $args, $value = null ) {
if ( ! isset( $args['class'] ) ) {
$args['class'] = array();
} else {
- 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_page
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render_page() {
// maybe save and move onto the next step
$error_message = Framework\SV_WC_Helper::get_posted_value( 'save_step' ) ? $this->save_step( $this->current_step ) : '';
Method load_scripts_styles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function load_scripts_styles() {
$fw_version = $this->get_plugin()->get_assets_version();
$wc_version = defined( 'WC_VERSION' ) ? WC_VERSION : WC()->version ?? $fw_version;
Function render_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function render_content( $error_message = '' ) {
?>
<div class="wc-setup-content sv-wc-plugin-admin-setup-content <?php echo esc_attr( $this->get_slug() ) . '-content'; ?>">
- 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 save_step
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function save_step( $step_id ) {
$error_message = __( 'Oops! An error occurred, please try again.', 'woocommerce-plugin-framework' );
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 add_admin_notices
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function add_admin_notices() {
if ( Framework\SV_WC_Helper::is_current_screen( 'plugins' ) || $this->get_plugin()->is_plugin_settings() ) {
if ( $this->is_complete() && $this->get_documentation_notice_message() ) {
- 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
Consider simplifying this complex logical expression. Open
if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_12_3\\Admin\\Setup_Wizard' ) ) :
/**
* The plugin Setup Wizard class.
Function render_steps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function render_steps() {
?>
<ol class="wc-setup-steps">
- 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_setup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function init_setup() {
// get a step ID from $_GET
$current_step = sanitize_key( Framework\SV_WC_Helper::get_requested_value( 'step' ) );
$current_action = sanitize_key( Framework\SV_WC_Helper::get_requested_value( '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 get_additional_actions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function get_additional_actions() {
$next_steps = $this->get_next_steps();
$actions = 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"