Function wp_get_sidebars_widgets
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
function wp_get_sidebars_widgets($deprecated = true) {
global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
// If loading from front page, consult $_wp_sidebars_widgets rather than options
// to see if wp_convert_widget_settings() has made manipulations in memory.
- 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 widgets.php
has 657 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* API for creating dynamic sidebar without hardcoding functionality into
* themes. Includes both internal WordPress routines and theme use routines.
*
Function wp_convert_widget_settings
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
function wp_convert_widget_settings($base_name, $option_name, $settings) {
// This test may need expanding.
$single = $changed = false;
if ( empty($settings) ) {
$single = true;
- 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_active_widget
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
global $wp_registered_widgets;
$sidebars_widgets = wp_get_sidebars_widgets();
- 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_callback
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function update_callback( $widget_args = 1 ) {
global $wp_registered_widgets;
if ( is_numeric($widget_args) )
$widget_args = array( 'number' => $widget_args );
- 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 dynamic_sidebar
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function dynamic_sidebar($index = 1) {
global $wp_registered_sidebars, $wp_registered_widgets;
if ( is_int($index) ) {
$index = "sidebar-$index";
- 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 wp_get_sidebars_widgets
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_get_sidebars_widgets($deprecated = true) {
global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
// If loading from front page, consult $_wp_sidebars_widgets rather than options
// to see if wp_convert_widget_settings() has made manipulations in memory.
Method update_callback
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update_callback( $widget_args = 1 ) {
global $wp_registered_widgets;
if ( is_numeric($widget_args) )
$widget_args = array( 'number' => $widget_args );
Method wp_convert_widget_settings
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_convert_widget_settings($base_name, $option_name, $settings) {
// This test may need expanding.
$single = $changed = false;
if ( empty($settings) ) {
$single = true;
Method dynamic_sidebar
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function dynamic_sidebar($index = 1) {
global $wp_registered_sidebars, $wp_registered_widgets;
if ( is_int($index) ) {
$index = "sidebar-$index";
Method wp_register_widget_control
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
$id = strtolower($id);
$id_base = _get_widget_id_base($id);
Function is_dynamic_sidebar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function is_dynamic_sidebar() {
global $wp_registered_widgets, $wp_registered_sidebars;
$sidebars_widgets = get_option('sidebars_widgets');
foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
if ( count($sidebars_widgets[$index]) ) {
- 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 wp_register_sidebar_widget
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
$id = strtolower($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 register_sidebars
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function register_sidebars($number = 1, $args = array()) {
global $wp_registered_sidebars;
$number = (int) $number;
if ( is_string($args) )
- 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 wp_register_widget_control
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
$id = strtolower($id);
$id_base = _get_widget_id_base($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 _register
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function _register() {
$settings = $this->get_settings();
$empty = true;
if ( is_array($settings) ) {
- 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_widget_control
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function register_widget_control($name, $control_callback, $width = '', $height = '') {
// Compat
if ( is_array($name) ) {
if ( count($name) == 3 )
$name = sprintf($name[0], $name[2]);
- 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_sidebar_widget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function register_sidebar_widget($name, $output_callback, $classname = '') {
// Compat
if ( is_array($name) ) {
if ( count($name) == 3 )
$name = sprintf($name[0], $name[2]);
- 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"