Skip to content

Instantly share code, notes, and snippets.

@boscho87
Created June 13, 2018 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boscho87/e7bc2ccb12c4f4038b0a3d1c341f36fd to your computer and use it in GitHub Desktop.
Save boscho87/e7bc2ccb12c4f4038b0a3d1c341f36fd to your computer and use it in GitHub Desktop.
Example of bad comments
<?php
/** example one (with to much comments) **/
/** --- class code here ---- */
/**
* if its not an admin user and the csrf token is okay and the
* current system is admin_system
**/
public function chgUsrPwd(User $user, string $npwd)
{
if($user->notAdmUsr() && $this->CsrfOk() && $this->currsys === 'admin_system'){
//set the new password of the user
$user->setPwd($npwd);
return false;
}
return true;
}
?>
<?php
/** example two **/
/** --- class code here ---- */
public function changeUserPassword(User $user, string $newPassword)
{
if($user->notAdminUser() && $this->CsrfIsValid() && $this->currentSystem === 'admin_system'){
$user->setNewPassword($newPassword);
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment