Conditions | 6 |
Paths | 3 |
Total Lines | 32 |
Code Lines | 11 |
Lines | 9 |
Ratio | 28.13 % |
1 | <?php |
||
25 | public static function get_full_name( $user_id ){ |
||
26 | |||
27 | $full_name = ''; |
||
|
|||
28 | |||
29 | if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
||
30 | || !( get_userdata( $user_id ) ) ){ |
||
31 | return false; |
||
32 | } |
||
33 | |||
34 | // get the user details |
||
35 | $user = get_user_by( 'id', $user_id ); |
||
36 | |||
37 | View Code Duplication | if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
38 | |||
39 | $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
||
40 | |||
41 | }else{ |
||
42 | |||
43 | $full_name = $user->display_name; |
||
44 | |||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Filter the user full name from the get_learner_full_name function. |
||
49 | * |
||
50 | * @since 1.8.0 |
||
51 | * @param $full_name |
||
52 | * @param $user_id |
||
53 | */ |
||
54 | return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
||
55 | |||
56 | }// end get_full_name |
||
57 | |||
58 | } |
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.