Function menu_item_classes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function menu_item_classes( $menu_items ) {
if ( ! function_exists( 'is_lifterlms' ) || ! is_lifterlms() ) {
return $menu_items;
}
- 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 ( $blog_id === $object_id ) {
$menu_items[ $key ]->current = false;
foreach ( array( 'current_page_parent', 'current-menu-item' ) as $class ) {
if ( in_array( $class, $classes, true ) ) {
Function get_nav_items
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function get_nav_items() {
$items = array();
foreach ( LLMS_Student_Dashboard::get_tabs() as $id => $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 output
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output() {
?>
<div id="posttype-llms-nav-items" class="posttypediv">
<div id="tabs-panel-llms-nav-items" class="tabs-panel tabs-panel-active">
Method get_nav_items
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get_nav_items() {
$items = array();
foreach ( LLMS_Student_Dashboard::get_tabs() as $id => $data ) {
Function filter_nav_items
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function filter_nav_items( $items ) {
$urls = array(
'#llms-signout',
'#llms-signin',
- 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 menu_item_classes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function menu_item_classes( $menu_items ) {
if ( ! function_exists( 'is_lifterlms' ) || ! is_lifterlms() ) {
return $menu_items;
}