Example #1
0
 /**
  * Factory that fills the required fields of the user.
  *
  * @param string                  $username
  * @param string                  $password
  * @param string                  $email
  * @param PasswordHasherInterface $passwordHasher
  *
  * @return User
  */
 public static function create(string $username, string $password, string $email, PasswordHasherInterface $passwordHasher) : self
 {
     $user = new self();
     $user->setOrUpdatePassword($password, $passwordHasher);
     $user->username = $username;
     $user->email = $email;
     return $user;
 }