42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\User;
|
|
|
|
use App\Shared\Pagination\PaginatedResult;
|
|
use App\User\Exception\DuplicateEmailException;
|
|
use App\User\Exception\DuplicateUsernameException;
|
|
use App\User\Exception\InvalidRoleException;
|
|
use App\User\Exception\WeakPasswordException;
|
|
|
|
/**
|
|
* Contrat applicatif du domaine User.
|
|
*/
|
|
interface UserServiceInterface
|
|
{
|
|
/** @return User[] */
|
|
public function findAll(): array;
|
|
|
|
/**
|
|
* @return PaginatedResult<User>
|
|
*/
|
|
public function findPaginated(int $page, int $perPage): PaginatedResult;
|
|
|
|
public function findById(int $id): ?User;
|
|
|
|
public function delete(int $id): void;
|
|
|
|
/**
|
|
* @throws DuplicateUsernameException
|
|
* @throws DuplicateEmailException
|
|
* @throws WeakPasswordException
|
|
* @throws InvalidRoleException
|
|
*/
|
|
public function createUser(string $username, string $email, string $plainPassword, string $role = User::ROLE_USER): User;
|
|
|
|
/**
|
|
* @throws InvalidRoleException
|
|
*/
|
|
public function updateRole(int $id, string $role): void;
|
|
}
|