| Conditions | 28 | 
| Paths | > 20000 | 
| Total Lines | 104 | 
| Code Lines | 54 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 36 | 	public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { | 
            ||
| 37 | $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * If this is a default menu being called we need to fix  | 
            ||
| 41 | * the item object thats coming through.  | 
            ||
| 42 | */  | 
            ||
| 43 | 		if(!isset($item->title)){ | 
            ||
| 44 | return;  | 
            ||
| 45 | }  | 
            ||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * Dividers, Headers or Disabled  | 
            ||
| 49 | * =============================  | 
            ||
| 50 | * Determine whether the item is a Divider, Header, Disabled or regular  | 
            ||
| 51 | * menu item. To prevent errors we use the strcasecmp() function to so a  | 
            ||
| 52 | * comparison that is not case sensitive. The strcasecmp() function returns  | 
            ||
| 53 | * a 0 if the strings are equal.  | 
            ||
| 54 | */  | 
            ||
| 55 | 		if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) { | 
            ||
| 56 | $output .= $indent . '<li role="presentation" class="divider">';  | 
            ||
| 57 | 		} else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) { | 
            ||
| 58 | $output .= $indent . '<li role="presentation" class="divider">';  | 
            ||
| 59 | 		} else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) { | 
            ||
| 60 | $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );  | 
            ||
| 61 | 		} else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) { | 
            ||
| 62 | $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';  | 
            ||
| 63 | 		} else { | 
            ||
| 64 | |||
| 65 | $class_names = $value = '';  | 
            ||
| 66 | |||
| 67 | $classes = empty( $item->classes ) ? array() : (array) $item->classes;  | 
            ||
| 68 | $classes[] = 'menu-item-' . $item->ID;  | 
            ||
| 69 | |||
| 70 | $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args , $depth );  | 
            ||
| 71 | |||
| 72 | $class_names = join( ' ', $classes );  | 
            ||
| 73 | |||
| 74 | if ( $args->has_children )  | 
            ||
| 75 | $class_names .= ' dropdown';  | 
            ||
| 76 | |||
| 77 | if ( in_array( 'current-menu-item', $classes ) )  | 
            ||
| 78 | $class_names .= ' active';  | 
            ||
| 79 | |||
| 80 | if ( in_array( 'current-menu-parent', $classes ) )  | 
            ||
| 81 | $class_names .= ' active';  | 
            ||
| 82 | |||
| 83 | //Check if this is ment to be a "social" type menu  | 
            ||
| 84 | $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';  | 
            ||
| 85 | |||
| 86 | $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );  | 
            ||
| 87 | $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';  | 
            ||
| 88 | |||
| 89 | $output .= $indent . '<li' . $id . $value . $class_names .'>';  | 
            ||
| 90 | |||
| 91 | $atts = array();  | 
            ||
| 92 | $atts['title'] = ! empty( $item->title ) ? $item->title : '';  | 
            ||
| 93 | $atts['target'] = ! empty( $item->target ) ? $item->target : '';  | 
            ||
| 94 | $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';  | 
            ||
| 95 | |||
| 96 | // If item has_children add atts to a.  | 
            ||
| 97 | 			if ( $args->has_children ) { | 
            ||
| 98 | $atts['href'] = ! empty( $item->url ) ? $item->url : '';  | 
            ||
| 99 | $atts['data-toggle'] = 'dropdown';  | 
            ||
| 100 | $atts['class'] = 'dropdown-toggle';  | 
            ||
| 101 | $atts['aria-haspopup'] = 'true';  | 
            ||
| 102 | 			} else { | 
            ||
| 103 | $atts['href'] = ! empty( $item->url ) ? $item->url : '';  | 
            ||
| 104 | }  | 
            ||
| 105 | |||
| 106 | $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );  | 
            ||
| 107 | |||
| 108 | $attributes = '';  | 
            ||
| 109 | 			foreach ( $atts as $attr => $value ) { | 
            ||
| 110 | 				if ( ! empty( $value ) ) { | 
            ||
| 111 | $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );  | 
            ||
| 112 | $attributes .= ' ' . $attr . '="' . $value . '"';  | 
            ||
| 113 | }  | 
            ||
| 114 | }  | 
            ||
| 115 | |||
| 116 | $item_output = $args->before;  | 
            ||
| 117 | |||
| 118 | /*  | 
            ||
| 119 | * Glyphicons  | 
            ||
| 120 | * ===========  | 
            ||
| 121 | * Since the the menu item is NOT a Divider or Header we check the see  | 
            ||
| 122 | * if there is a value in the attr_title property. If the attr_title  | 
            ||
| 123 | * property is NOT null we apply it as the class name for the glyphicon.  | 
            ||
| 124 | */  | 
            ||
| 125 | 			if ( ! empty( $item->attr_title ) ) { | 
            ||
| 126 | $item_output .= '<a'. $attributes .'"><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> ';  | 
            ||
| 127 | 			} else { | 
            ||
| 128 | $item_output .= '<a'. $attributes .'>';  | 
            ||
| 129 | }  | 
            ||
| 130 | |||
| 131 | $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;  | 
            ||
| 132 | $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';  | 
            ||
| 133 | $item_output .= $args->after;  | 
            ||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );  | 
            ||
| 138 | }  | 
            ||
| 139 | }  | 
            ||
| 140 | |||
| 234 | 
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.