From ec0ad08ec38f7739d22c2525b01bbaade58b4996 Mon Sep 17 00:00:00 2001 From: bidi Date: Mon, 16 Dec 2024 12:11:28 +0200 Subject: [PATCH] refactoring Signed-off-by: bidi --- src/User/src/Service/UserService.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/User/src/Service/UserService.php b/src/User/src/Service/UserService.php index 8fdf2c9..2ecb41f 100644 --- a/src/User/src/Service/UserService.php +++ b/src/User/src/Service/UserService.php @@ -75,13 +75,7 @@ public function __construct( */ public function findByUuid(string $uuid): ?User { - $user = $this->userRepository->findByUuid($uuid); - - if (! $user instanceof User || $user->isDeleted()) { - return null; - } - - return $user; + return $this->userRepository->findByUuid($uuid); } /** @@ -182,11 +176,11 @@ public function updateUser(User $user, array $data = []): User public function deleteUser(User $user): User { - $user->setStatus(UserStatusEnum::Deleted); $placeholder = $this->getAnonymousPlaceholder(); // make user anonymous $user + ->setStatus(UserStatusEnum::Deleted) ->setIdentity($placeholder . $this->config['userAnonymizeAppend']) ->getDetail() ->setFirstName($placeholder) @@ -331,13 +325,7 @@ public function findByResetPasswordHash(?string $hash): ?User return null; } - $user = $this->userRepository->findByResetPasswordHash($hash); - - if (! $user instanceof User || $user->isDeleted()) { - return null; - } - - return $user; + return $this->userRepository->findByResetPasswordHash($hash); } /**