Total Complexity | 6 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | class ReadUser implements ReadUserDomain |
||
23 | { |
||
24 | private UserRepository $userRepository; |
||
25 | |||
26 | public function __construct(UserRepository $userRepository) |
||
27 | { |
||
28 | $this->userRepository = $userRepository; |
||
29 | } |
||
30 | |||
31 | public function existsWithUsername(string $username): bool |
||
32 | { |
||
33 | return $this->userRepository->existWithUsername($username); |
||
34 | } |
||
35 | |||
36 | public function existsWithEmail(string $email): bool |
||
37 | { |
||
38 | return $this->userRepository->existWithEmail($email); |
||
39 | } |
||
40 | |||
41 | public function findOneByUuid(string $uuid): User |
||
42 | { |
||
43 | $user = $this->userRepository->findOneByUuid(ResourceUuid::fromString($uuid)->__toString()); |
||
44 | |||
45 | if (!$user instanceof User) { |
||
46 | throw new UserNotFoundException(); |
||
47 | } |
||
48 | |||
49 | return $user; |
||
50 | } |
||
51 | |||
52 | public function findAll(): array |
||
55 | } |
||
56 | } |
||
57 |