Conditions | 6 |
Paths | 3 |
Total Lines | 32 |
Code Lines | 11 |
Lines | 9 |
Ratio | 28.13 % |
1 | <?php |
||
22 | public static function get_full_name( $user_id ){ |
||
23 | |||
24 | $full_name = ''; |
||
|
|||
25 | |||
26 | if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
||
27 | || !( get_userdata( $user_id ) ) ){ |
||
28 | return false; |
||
29 | } |
||
30 | |||
31 | // get the user details |
||
32 | $user = get_user_by( 'id', $user_id ); |
||
33 | |||
34 | View Code Duplication | if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
35 | |||
36 | $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
||
37 | |||
38 | }else{ |
||
39 | |||
40 | $full_name = $user->display_name; |
||
41 | |||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Filter the user full name from the get_learner_full_name function. |
||
46 | * |
||
47 | * @since 1.8.0 |
||
48 | * @param $full_name |
||
49 | * @param $user_id |
||
50 | */ |
||
51 | return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
||
52 | |||
53 | }// end get_full_name |
||
54 | |||
55 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.