29 lines
784 B
PHP
29 lines
784 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Cqs\Actions\Users;
|
||
|
|
|
||
|
|
use App\Contracts\ActionInput;
|
||
|
|
use Domain\Enums\UserRole;
|
||
|
|
use Webmozart\Assert\Assert;
|
||
|
|
|
||
|
|
final readonly class CreateUserInput implements ActionInput
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
public string $firstname,
|
||
|
|
public string $lastname,
|
||
|
|
public string $email,
|
||
|
|
public string $password,
|
||
|
|
public UserRole $role,
|
||
|
|
) {
|
||
|
|
Assert::stringNotEmpty(trim($this->firstname));
|
||
|
|
Assert::maxLength($this->firstname, 255);
|
||
|
|
Assert::stringNotEmpty(trim($this->lastname));
|
||
|
|
Assert::maxLength($this->lastname, 255);
|
||
|
|
Assert::stringNotEmpty(trim($this->email));
|
||
|
|
Assert::maxLength($this->email, 255);
|
||
|
|
Assert::stringNotEmpty($this->password);
|
||
|
|
}
|
||
|
|
}
|