Function _bind
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
final protected function _bind() {
if ( $this->bound )
return;
// Add the root node.
- 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 class-wp-admin-bar.php
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* The WordPress Toolbar
*
* @since 3.1.0
Method _bind
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
final protected function _bind() {
if ( $this->bound )
return;
// Add the root node.
Function _render_item
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
final protected function _render_item( $node ) {
if ( $node->type != 'item' )
return;
$is_parent = ! empty( $node->children );
- 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_item
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
final protected function _render_item( $node ) {
if ( $node->type != 'item' )
return;
$is_parent = ! empty( $node->children );
WP_Admin_Bar
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class WP_Admin_Bar {
private $nodes = array();
private $bound = false;
public $user;
Method add_node
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_node( $args ) {
// Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
Function add_node
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function add_node( $args ) {
// Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(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 _render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
final protected function _render( $root ) {
global $is_IE;
// Add browser classes.
// We have to do this here since admin bar shows on the front end.
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function initialize() {
$this->user = new stdClass;
if ( is_user_logged_in() ) {
/* Populate settings we need for the menu based on the current user. */
- 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_group
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
final protected function _render_group( $node ) {
if ( $node->type == 'container' )
return $this->_render_container( $node );
if ( $node->type != 'group' || empty( $node->children ) )
- 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"