Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
62 | public function getUserByAttributes($data) { |
||
63 | $user = false; |
||
64 | |||
65 | if ($data["guid"]) { |
||
66 | $user = get_entity($data["guid"]); |
||
67 | } elseif ($data["username"]) { |
||
68 | $user = get_user_by_username($data["username"]); |
||
69 | } elseif ($data["email"]) { |
||
70 | $users = get_user_by_email($data["email"]); |
||
71 | $user = $users[0]; |
||
72 | } |
||
73 | |||
74 | return $user; |
||
75 | } |
||
76 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.