-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUserRepository.php
More file actions
46 lines (36 loc) · 859 Bytes
/
UserRepository.php
File metadata and controls
46 lines (36 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace MsgPhp\User\Repository;
use MsgPhp\Domain\DomainCollection;
use MsgPhp\User\User;
use MsgPhp\User\UserId;
/**
* @author Roland Franssen <[email protected]>
*
* @template T of User
*/
interface UserRepository
{
/**
* @return DomainCollection<array-key, T>
*/
public function findAll(int $offset = 0, int $limit = 0): DomainCollection;
/**
* @return T
*/
public function find(UserId $id): User;
/**
* @return T
*/
public function findByUsername(string $username): User;
public function exists(UserId $id): bool;
public function usernameExists(string $username): bool;
/**
* @param T $user
*/
public function save(User $user): void;
/**
* @param T $user
*/
public function delete(User $user): void;
}