Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like SwDatabase often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SwDatabase, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 25 | class SwDatabase |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * getJobsToDiv function |
||
| 29 | * @param int $id |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | public function getJobsToDiv($id) |
||
| 33 | { |
||
| 34 | global $xoopsUser, $xoopsDB; |
||
| 35 | $msg = []; |
||
| 36 | $new = []; |
||
|
|
|||
| 37 | $sql = 'SELECT employer,position,jobstart,jobstop,description FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'"; |
||
| 38 | $result = $xoopsDB->query($sql); |
||
| 39 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
| 40 | $employer = unserialize($row['employer']); |
||
| 41 | $position = unserialize($row['position']); |
||
| 42 | $jobstart = unserialize($row['jobstart']); |
||
| 43 | $jobstop = unserialize($row['jobstop']); |
||
| 44 | $description = unserialize($row['description']); |
||
| 45 | } |
||
| 46 | $start = 0; |
||
| 47 | $end = count($employer) - 1; |
||
| 48 | while ($start <= $end) { |
||
| 49 | $msg[$start]['employer'] = $employer[$start]; |
||
| 50 | $msg[$start]['position'] = $position[$start]; |
||
| 51 | $msg[$start]['jobstart'] = $jobstart[$start]; |
||
| 52 | $msg[$start]['jobstop'] = $jobstop[$start]; |
||
| 53 | $msg[$start]['description'] = $description[$start]; |
||
| 54 | ++$start; |
||
| 55 | } |
||
| 56 | |||
| 57 | return $msg; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * getSchoolToDiv function |
||
| 62 | * @param int $id |
||
| 63 | * @return array |
||
| 64 | */ |
||
| 65 | public function getSchoolToDiv($id) |
||
| 66 | { |
||
| 67 | global $xoopsUser, $xoopsDB, $arr7; |
||
| 68 | $msg = []; |
||
| 69 | $sql = 'SELECT school_type,school,schoolstart,schoolstop FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'"; |
||
| 70 | $result = $xoopsDB->query($sql); |
||
| 71 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
| 72 | $school_type = unserialize($row['school_type']); |
||
| 73 | $school = unserialize($row['school']); |
||
| 74 | $schoolstart = unserialize($row['schoolstart']); |
||
| 75 | $schoolstop = unserialize($row['schoolstop']); |
||
| 76 | } |
||
| 77 | $start = 0; |
||
| 78 | $end = count($school_type) - 1; |
||
| 79 | while ($start <= $end) { |
||
| 80 | $msg[$start]['school_type'] = $school_type[$start]; |
||
| 81 | $msg[$start]['school'] = $arr7[$school[$start]]; |
||
| 82 | $msg[$start]['schoolstart'] = $schoolstart[$start]; |
||
| 83 | $msg[$start]['schoolstop'] = $schoolstop[$start]; |
||
| 84 | $start++; |
||
| 85 | } |
||
| 86 | |||
| 87 | return $msg; |
||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * getScreennamesToDiv function |
||
| 92 | * @param int $id |
||
| 93 | * @return array |
||
| 94 | */ |
||
| 95 | public function getScreennamesToDiv($id) |
||
| 96 | { |
||
| 97 | global $xoopsUser, $xoopsDB, $arr06; |
||
| 98 | $msg = []; |
||
| 99 | $sql = 'SELECT screenname_type,screenname FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'"; |
||
| 100 | $result = $xoopsDB->query($sql); |
||
| 101 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
| 102 | $screenname_type = unserialize($row['screenname_type']); |
||
| 103 | $screenname = unserialize($row['screenname']); |
||
| 104 | } |
||
| 105 | $start = 0; |
||
| 106 | $end = count($screenname_type) - 1; |
||
| 107 | while ($start <= $end) { |
||
| 108 | $msg[$start]['screenname'] = $screenname_type[$start]; |
||
| 109 | $msg[$start]['screenname_type'] = $arr06[$screenname[$start]]; |
||
| 110 | $msg[$start]['link'] = "<span class='smallworld_website'>" . smallworld_sociallinks($screenname[$start], $msg[$start]['screenname']); |
||
| 111 | ++$start; |
||
| 112 | } |
||
| 113 | |||
| 114 | return $msg; |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * getVar function |
||
| 119 | * @param int $id |
||
| 120 | * @param string $var |
||
| 121 | * @return array|int |
||
| 122 | */ |
||
| 123 | public function getVar($id, $var) |
||
| 124 | { |
||
| 125 | global $xoopsUser, $xoopsDB; |
||
| 126 | $sql = 'SELECT ' . $var . ' FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . $id . "'"; |
||
| 127 | $result = $xoopsDB->queryF($sql); |
||
| 128 | if ($xoopsDB->getRowsNum($result) < 1) { |
||
| 129 | return 0; //_SMALLWORLD_REPLY_NOTSPECIFIED; |
||
| 130 | } |
||
| 131 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
| 132 | $msg[$var] = $row[$var]; |
||
| 133 | } |
||
| 134 | |||
| 135 | return $msg[$var]; |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * updateSingleValue function |
||
| 140 | * @param string $table |
||
| 141 | * @param int $userid |
||
| 142 | * @param string $field |
||
| 143 | * @param int $value |
||
| 144 | */ |
||
| 145 | public function updateSingleValue($table, $userid, $field, $value) |
||
| 146 | { |
||
| 147 | global $xoopsUser, $xoopsDB; |
||
| 148 | $myts = \MyTextSanitizer::getInstance(); |
||
| 149 | $sql = 'UPDATE ' . $xoopsDB->prefix($table) . ' SET ' . $field . "='" . $myts->addSlashes($value) . "' WHERE userid='" . (int)$userid . "'"; |
||
| 150 | $result = $xoopsDB->queryF($sql); |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * saveImage function |
||
| 155 | * @param $values |
||
| 156 | */ |
||
| 157 | View Code Duplication | public function saveImage($values) |
|
| 158 | { |
||
| 159 | global $xoopsUser, $xoopsDB; |
||
| 160 | $myts = \MyTextSanitizer::getInstance(); |
||
| 161 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_images') . ' VALUES (' . $values . ')'; |
||
| 162 | $result = $xoopsDB->queryF($sql); |
||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * DeleteImage function |
||
| 167 | * @param int $userid |
||
| 168 | * @param string $imagename |
||
| 169 | */ |
||
| 170 | View Code Duplication | public function deleteImage($userid, $imagename) |
|
| 171 | { |
||
| 172 | global $xoopsUser, $xoopsDB; |
||
| 173 | $myts = \MyTextSanitizer::getInstance(); |
||
| 174 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_images') . " WHERE imgname = '" . stripslashes($imagename) . "' AND userid='" . $userid . "'"; |
||
| 175 | $result = $xoopsDB->queryF($sql); |
||
| 176 | } |
||
| 177 | |||
| 178 | /** |
||
| 179 | * handlePosts function |
||
| 180 | */ |
||
| 181 | public function handlePosts() |
||
| 182 | { |
||
| 183 | global $xoopsUser, $xoopsDB; |
||
| 184 | $myts = \MyTextSanitizer::getInstance(); |
||
| 185 | $uid = $xoopsUser->getVar('uid'); |
||
| 186 | $user = new \XoopsUser($uid); |
||
| 187 | $img = new Images(); |
||
| 188 | if ('' == $this->getVar($uid, 'userimage')) { |
||
| 189 | $avatar = $user->user_avatar(); |
||
| 190 | } else { |
||
| 191 | $avatar = $this->getVar($uid, 'userimage'); |
||
| 192 | } |
||
| 193 | |||
| 194 | if ('2' != $_POST['relationship']) { |
||
| 195 | $partner = smallworld_sanitize($_POST['partner']); |
||
| 196 | } else { |
||
| 197 | $partner = ''; |
||
| 198 | } |
||
| 199 | |||
| 200 | $regdate = time(); |
||
| 201 | $username = $user->uname(); |
||
| 202 | $realname = smallworld_sanitize($_POST['realname']); |
||
| 203 | $gender = isset($_POST['gender']) ? $_POST['gender'] : ''; |
||
| 204 | $intingender = isset($_POST['intingender']) ? smallworld_sanitize(serialize($_POST['intingender'])) : smallworld_sanitize(serialize([0 => '3'])); |
||
| 205 | $relationship = smallworld_sanitize($_POST['relationship']); |
||
| 206 | $searchrelat = isset($_POST['searchrelat']) ? smallworld_sanitize(serialize($_POST['searchrelat'])) : smallworld_sanitize(serialize([0 => '0'])); |
||
| 207 | $birthday = smallworld_sanitize(smallworld_euroToUsDate($_POST['birthday'])); |
||
| 208 | $birthplace = smallworld_sanitize($_POST['birthplace']); |
||
| 209 | $birthplace_lat = smallworld_sanitize($_POST['birthplace_lat']); |
||
| 210 | $birthplace_lng = smallworld_sanitize($_POST['birthplace_lng']); |
||
| 211 | $birthplace_country = smallworld_sanitize($_POST['birthplace_country']); |
||
| 212 | $birthplace_country_img = isset($_POST['birthplace_country_img']) ? smallworld_sanitize($_POST['birthplace_country_img']) : ''; |
||
| 213 | $politic = smallworld_sanitize($_POST['politic']); |
||
| 214 | $religion = smallworld_sanitize($_POST['religion']); |
||
| 215 | $emailtype = smallworld_sanitize(serialize($_POST['emailtype'])); |
||
| 216 | $screenname_type = smallworld_sanitize(serialize($_POST['screenname_type'])); |
||
| 217 | $screenname = smallworld_sanitize(serialize($_POST['screenname'])); |
||
| 218 | $mobile = smallworld_sanitize($_POST['mobile']); |
||
| 219 | $phone = smallworld_sanitize($_POST['phone']); |
||
| 220 | $adress = smallworld_sanitize($_POST['adress']); |
||
| 221 | $present_city = smallworld_sanitize($_POST['present_city']); |
||
| 222 | $present_lat = smallworld_sanitize($_POST['present_lat']); |
||
| 223 | $present_lng = smallworld_sanitize($_POST['present_lng']); |
||
| 224 | $present_country = smallworld_sanitize($_POST['present_country']); |
||
| 225 | $present_country_img = isset($_POST['present_country_img']) ? smallworld_sanitize($_POST['present_country_img']) : ''; |
||
| 226 | $website = smallworld_sanitize($_POST['website']); |
||
| 227 | $interests = smallworld_sanitize($_POST['interests']); |
||
| 228 | $music = smallworld_sanitize($_POST['music']); |
||
| 229 | $tvshow = smallworld_sanitize($_POST['tvshow']); |
||
| 230 | $movie = smallworld_sanitize($_POST['movie']); |
||
| 231 | $books = smallworld_sanitize($_POST['books']); |
||
| 232 | $aboutme = smallworld_sanitize($_POST['aboutme']); |
||
| 233 | $school_type = smallworld_sanitize(serialize($_POST['school_type'])); |
||
| 234 | $school = smallworld_sanitize(serialize($_POST['school'])); |
||
| 235 | $schoolstart = smallworld_sanitize(serialize($_POST['schoolstart'])); |
||
| 236 | $schoolstop = smallworld_sanitize(serialize($_POST['schoolstop'])); |
||
| 237 | $jobemployer = smallworld_sanitize(serialize($_POST['employer'])); |
||
| 238 | $jobposition = smallworld_sanitize(serialize($_POST['position'])); |
||
| 239 | $jobstart = smallworld_sanitize(serialize(smallworld_YearOfArray($_POST['jobstart']))); |
||
| 240 | $jobstop = smallworld_sanitize(serialize(smallworld_YearOfArray($_POST['jobstop']))); |
||
| 241 | $jobdescription = smallworld_sanitize(serialize($_POST['description'])); |
||
| 242 | |||
| 243 | $sql = ''; |
||
| 244 | |||
| 245 | if ('edit' === $_POST['function']) { |
||
| 246 | // Update all values in user_table |
||
| 247 | $sql = 'UPDATE ' . $xoopsDB->prefix('smallworld_user') . ' SET '; |
||
| 248 | $sql .= "realname = '" . $realname . "', username= '" . $username . "', userimage = '" . $avatar . "', gender = '" . $gender . "',"; |
||
| 249 | $sql .= "intingender = '" . $intingender . "',relationship = '" . $relationship . "', partner = '" . $partner . "', searchrelat = '" . $searchrelat . "',"; |
||
| 250 | $sql .= "birthday = '" . $birthday . "',birthplace = '" . $birthplace . "',birthplace_lat = '" . (float)$birthplace_lat . "',"; |
||
| 251 | $sql .= "birthplace_lng = '" . (float)$birthplace_lng . "',birthplace_country = '" . $birthplace_country . "',politic = '" . $politic . "',"; |
||
| 252 | $sql .= "religion = '" . $religion . "',emailtype = '" . $emailtype . "',screenname_type = '" . $screenname_type . "',"; |
||
| 253 | $sql .= "screenname = '" . $screenname . "',mobile = '" . (float)$mobile . "',phone = '" . (float)$phone . "',adress = '" . $adress . "',"; |
||
| 254 | $sql .= "present_city = '" . $present_city . "',present_lat = '" . (float)$present_lat . "',present_lng = '" . (float)$present_lng . "',"; |
||
| 255 | $sql .= "present_country = '" . $present_country . "',website = '" . $website . "',interests = '" . $interests . "',"; |
||
| 256 | $sql .= "music = '" . $music . "',tvshow = '" . $tvshow . "',movie = '" . $movie . "',"; |
||
| 257 | $sql .= "books = '" . $books . "',aboutme = '" . $aboutme . "',school_type = '" . $school_type . "',"; |
||
| 258 | $sql .= "school = '" . $school . "', schoolstart = '" . $schoolstart . "',schoolstop = '" . $schoolstop . "',"; |
||
| 259 | $sql .= "employer = '" . $jobemployer . "', position = '" . $jobposition . "',jobstart = '" . $jobstart . "',"; |
||
| 260 | $sql .= "jobstop = '" . $jobstop . "', description = '" . $jobdescription . "' "; |
||
| 261 | $sql .= "WHERE userid ='" . (int)$uid . "'"; |
||
| 262 | $result = $xoopsDB->queryF($sql); |
||
| 263 | if (false === $result) { |
||
| 264 | die('SQL error:' . $sql . ''); |
||
| 265 | } |
||
| 266 | |||
| 267 | $this->EditAdmins($uid, $realname, $avatar); |
||
| 268 | $img->createAlbum($uid); |
||
| 269 | } |
||
| 270 | |||
| 271 | if ('save' === $_POST['function']) { |
||
| 272 | $sql = 'INSERT INTO ' |
||
| 273 | . $xoopsDB->prefix('smallworld_user') |
||
| 274 | . ' (id, userid, regdate, username, userimage, realname, gender, intingender, relationship, partner, searchrelat, birthday, birthplace, birthplace_lat, birthplace_lng, birthplace_country, politic, religion, emailtype, screenname_type, screenname, mobile, phone, adress, present_city, present_lat, present_lng, present_country, website, interests, music, tvshow, movie, books, aboutme, school_type, school, schoolstart, schoolstop, employer, position, jobstart, jobstop, description, friends, followers, admin_flag) '; |
||
| 275 | $sql .= "VALUES ('','" . (int)$uid . "', '" . $regdate . "', '" . $username . "', '" . $avatar . "', '" . $realname . "', '" . $gender . "', '" . $intingender . "', '" . $relationship . "', '" . $partner . "', '" . $searchrelat . "','"; |
||
| 276 | $sql .= $birthday . "', '" . $birthplace . "', '" . (float)$birthplace_lat . "', '" . (float)$birthplace_lng . "', '" . $birthplace_country . "', '" . $politic . "', '" . $religion . "','"; |
||
| 277 | $sql .= $emailtype . "', '" . $screenname_type . "', '" . $screenname . "', '" . (float)$mobile . "', '" . (float)$phone . "', '" . $adress . "', '" . $present_city . "', '" . (float)$present_lat . "','"; |
||
| 278 | $sql .= (float)$present_lng . "', '" . $present_country . "', '" . $website . "', '" . $interests . "', '" . $music . "', '" . $tvshow . "', '" . $movie . "', '" . $books . "', '" . $aboutme . "', '"; |
||
| 279 | $sql .= $school_type . "', '" . $school . "', '" . $schoolstart . "', '" . $schoolstop . "', '" . $jobemployer . "', '" . $jobposition . "', '" . $jobstart . "', '" . $jobstop . "', '" . $jobdescription . "', "; |
||
| 280 | $sql .= "'0', '0', '0')"; |
||
| 281 | $result = $xoopsDB->queryF($sql); |
||
| 282 | if (false === $result) { |
||
| 283 | die('SQL error:' . $sql . ''); |
||
| 284 | } |
||
| 285 | $this->setAdmins($uid, $username, $realname, $avatar); |
||
| 286 | $img->createAlbum($uid); |
||
| 287 | } |
||
| 288 | } |
||
| 289 | |||
| 290 | /** |
||
| 291 | * SetAdmins function |
||
| 292 | * @param int $userID |
||
| 293 | * @param string $username |
||
| 294 | * @param string $realname |
||
| 295 | * @param mixed $avatar |
||
| 296 | */ |
||
| 297 | public function setAdmins($userID, $username, $realname, $avatar) |
||
| 298 | { |
||
| 299 | global $xoopsDB, $xoopsUser; |
||
| 300 | $ip = $_SERVER['REMOTE_ADDR']; |
||
| 301 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_admin') . ' (id,userid,username, realname,userimage,ip,complaint,inspect_start, ' . "inspect_stop) VALUES ('', '" . $userID . "', '" . $username . "','" . $realname . "', '" . $avatar . "','" . $ip . "','0','0','0')"; |
||
| 302 | $result = $xoopsDB->queryF($sql); |
||
| 303 | } |
||
| 304 | |||
| 305 | /** |
||
| 306 | * EditAdmins function |
||
| 307 | * @param int $userID |
||
| 308 | * @param string $realname |
||
| 309 | * @param mixed $avatar |
||
| 310 | */ |
||
| 311 | public function EditAdmins($userID, $realname, $avatar) |
||
| 317 | |||
| 318 | /** |
||
| 319 | * alreadycomplaint function |
||
| 320 | * - Check if user has already sent complaint |
||
| 321 | * @param string $msg |
||
| 322 | * @param int $by |
||
| 323 | * @param int $against |
||
| 324 | * @return int |
||
| 325 | */ |
||
| 326 | public function alreadycomplaint($msg, $by, $against) |
||
| 339 | |||
| 340 | /** |
||
| 341 | * updateComplaint function |
||
| 342 | * @param int $userID |
||
| 343 | */ |
||
| 344 | public function updateComplaint($userID) |
||
| 345 | { |
||
| 346 | global $xoopsDB; |
||
| 350 | |||
| 351 | /** |
||
| 352 | * updateInspection function |
||
| 353 | * @param int $userID |
||
| 354 | * @param int $start |
||
| 355 | * @param mixed $stop |
||
| 356 | */ |
||
| 357 | public function updateInspection($userID, $start, $stop) |
||
| 364 | |||
| 365 | /** |
||
| 366 | * handleImageEdit function |
||
| 367 | */ |
||
| 368 | public function handleImageEdit() |
||
| 378 | |||
| 379 | /** |
||
| 380 | * updateInspection function |
||
| 381 | * - insert aplication for friendship into db or delete if denied |
||
| 382 | * @param int $status |
||
| 383 | * @param int $friendid |
||
| 384 | * @param int $userid |
||
| 385 | */ |
||
| 386 | public function toogleFriendInvite($status, $friendid, $userid) |
||
| 403 | |||
| 404 | /** |
||
| 405 | * toogleFollow function |
||
| 406 | * - Insert following to db or delete if requested |
||
| 407 | * @param int $following |
||
| 408 | * @param int $myUid |
||
| 409 | * @param int $friend |
||
| 410 | */ |
||
| 411 | public function toogleFollow($following, $myUid, $friend) |
||
| 426 | |||
| 427 | /** |
||
| 428 | * SetFriendshitStat function |
||
| 429 | * @param int $stat |
||
| 430 | * @param int $myUid |
||
| 431 | * @param int $friend |
||
| 432 | */ |
||
| 433 | public function setFriendshitStat($stat, $myUid, $friend) |
||
| 449 | |||
| 450 | /** |
||
| 451 | * deleteWallMsg function |
||
| 452 | * @param int $id |
||
| 453 | * @param int $smallworld_msg_id |
||
| 454 | * @return true |
||
| 455 | */ |
||
| 456 | public function deleteWallMsg($id, $smallworld_msg_id) |
||
| 469 | |||
| 470 | /** |
||
| 471 | * deleteWallComment function |
||
| 472 | * - Delete Comments |
||
| 473 | * @param int $smallworld_com_id |
||
| 474 | * @return true |
||
| 475 | */ |
||
| 476 | View Code Duplication | public function deleteWallComment($smallworld_com_id) |
|
| 486 | |||
| 487 | /** |
||
| 488 | * CountUsersRates function |
||
| 489 | * - Delete Comments |
||
| 490 | * @param int $userid |
||
| 491 | * @param string $val |
||
| 492 | * @return int |
||
| 493 | */ |
||
| 494 | View Code Duplication | public function countUsersRates($userid, $val) |
|
| 508 | |||
| 509 | /** |
||
| 510 | * deleteAccount function |
||
| 511 | * - Delete user account and associate rows across tables |
||
| 512 | * @param int $userid |
||
| 513 | * @return string |
||
| 514 | */ |
||
| 515 | View Code Duplication | public function deleteAccount($userid) |
|
| 546 | |||
| 547 | /** |
||
| 548 | * SmallworldDeleteDirectory function |
||
| 549 | * - Delete images from users on delete |
||
| 550 | * @param int $userid |
||
| 551 | * @return true |
||
| 552 | */ |
||
| 553 | public function SmallworldDeleteDirectory($userid) |
||
| 576 | |||
| 577 | /** |
||
| 578 | * smallworld_remDir function |
||
| 579 | * - Remove user image dir in uploads. |
||
| 580 | * @param int $userid |
||
| 581 | * @param string|bool $directory |
||
| 582 | * @param bool|int $empty |
||
| 583 | * @return bool |
||
| 584 | */ |
||
| 585 | View Code Duplication | public function smallworld_remDir($userid, $directory, $empty = false) |
|
| 618 | |||
| 619 | /** |
||
| 620 | * Update private settings |
||
| 621 | * @param mixed $id |
||
| 622 | * @param mixed $posts |
||
| 623 | */ |
||
| 624 | public function saveSettings($id, $posts) |
||
| 638 | |||
| 639 | /** |
||
| 640 | * Retrieve private settings |
||
| 641 | * @param mixed $userid |
||
| 642 | * @return string serialized string |
||
| 643 | */ |
||
| 644 | public function getSettings($userid) |
||
| 668 | } |
||
| 669 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.