Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class Create extends Base |
||
10 | { |
||
11 | public function create(array $input): object |
||
12 | 6 | { |
|
13 | $data = $this->validateUserData($input); |
||
14 | 6 | /** @var User $user */ |
|
15 | 6 | $user = $this->userRepository->create($data); |
|
16 | 1 | ||
17 | if (self::isRedisEnabled() === true) { |
||
18 | 5 | $this->saveInCache($user->getId(), $user->toJson()); |
|
19 | 1 | } |
|
20 | if (self::isLoggerEnabled() === true) { |
||
21 | 4 | $this->loggerService->setInfo('The user with the ID ' . $user->getId() . ' has created successfully.'); |
|
22 | 1 | } |
|
23 | |||
24 | 3 | return $user->toJson(); |
|
25 | 3 | } |
|
26 | 3 | ||
27 | 2 | /** |
|
28 | 2 | * @param array<string> $input |
|
29 | 2 | */ |
|
30 | private function validateUserData(array $input): User |
||
50 | } |
||
51 | } |
||
52 |