CreateUser
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- execute() : array{success: bool, user_id?: int, errors?: string[]}
- Create a new user.
Properties
$passwordHasher
private
PasswordHasher
$passwordHasher
$userRepository
private
UserRepositoryInterface
$userRepository
Methods
__construct()
public
__construct(UserRepositoryInterface $userRepository, PasswordHasher $passwordHasher) : mixed
Parameters
- $userRepository : UserRepositoryInterface
- $passwordHasher : PasswordHasher
execute()
Create a new user.
public
execute(string $username, string $email, string $password[, string $role = User::ROLE_USER ][, bool $isActive = true ]) : array{success: bool, user_id?: int, errors?: string[]}
Parameters
- $username : string
-
Username
- $email : string
-
Email address
- $password : string
-
Plain-text password
- $role : string = User::ROLE_USER
-
User role (user or admin)
- $isActive : bool = true
-
Whether the user is active