/**
  * Creates a user account.
  * The username can be an email or a mobile.
  *
  * @param string   $username
  * @param string   $password
  * @param string[] $roles
  *
  * @return string the already created uniqueness
  *
  * @throws EmptyPasswordInternalException
  * @throws InvalidUsernameInternalException
  * @throws ExistentUsernameInternalException
  */
 public function create($username, $password, $roles)
 {
     $uniqueness = $this->createUniquenessSharedWorker->create();
     try {
         $this->createProfilesInternalWorker->create($uniqueness, $username, $password, $roles);
     } catch (EmptyPasswordInternalException $e) {
         throw $e;
     } catch (InvalidUsernameInternalException $e) {
         throw $e;
     } catch (ExistentUsernameInternalException $e) {
         throw $e;
     }
     $this->logOperationInternalWorker->logCreation($uniqueness);
     return $uniqueness;
 }
Example #2
0
 /**
  * Creates a user account.
  * The username can be an email or a mobile.
  *
  * @param string   $id
  * @param string   $username
  * @param string   $password
  * @param string[] $roles
  *
  * @throws EmptyPasswordInternalException
  * @throws InvalidUsernameInternalException
  * @throws ExistentUsernameInternalException
  */
 public function create($id, $username, $password, $roles)
 {
     $this->createUniquenessTestWorker->create($id);
     $this->createProfilesInternalWorker->create($id, $username, $password, $roles);
 }