Web.Admin/2014/wordpress/wp-admin/includes/widgets.php
Method wp_widget_control
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function wp_widget_control( $sidebar_args ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
$widget_id = $sidebar_args['widget_id'];
$sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
Function wp_widget_control
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
function wp_widget_control( $sidebar_args ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
$widget_id = $sidebar_args['widget_id'];
$sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
- 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_list_widgets
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
function wp_list_widgets() {
global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
$sort = $wp_registered_widgets;
usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) );
- 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"