Skip to content

Commit ec0ad08

Browse files
committed
refactoring
Signed-off-by: bidi <bidi@apidemia.com>
1 parent 1b9d2a4 commit ec0ad08

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

src/User/src/Service/UserService.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,7 @@ public function __construct(
7575
*/
7676
public function findByUuid(string $uuid): ?User
7777
{
78-
$user = $this->userRepository->findByUuid($uuid);
79-
80-
if (! $user instanceof User || $user->isDeleted()) {
81-
return null;
82-
}
83-
84-
return $user;
78+
return $this->userRepository->findByUuid($uuid);
8579
}
8680

8781
/**
@@ -182,11 +176,11 @@ public function updateUser(User $user, array $data = []): User
182176

183177
public function deleteUser(User $user): User
184178
{
185-
$user->setStatus(UserStatusEnum::Deleted);
186179
$placeholder = $this->getAnonymousPlaceholder();
187180

188181
// make user anonymous
189182
$user
183+
->setStatus(UserStatusEnum::Deleted)
190184
->setIdentity($placeholder . $this->config['userAnonymizeAppend'])
191185
->getDetail()
192186
->setFirstName($placeholder)
@@ -331,13 +325,7 @@ public function findByResetPasswordHash(?string $hash): ?User
331325
return null;
332326
}
333327

334-
$user = $this->userRepository->findByResetPasswordHash($hash);
335-
336-
if (! $user instanceof User || $user->isDeleted()) {
337-
return null;
338-
}
339-
340-
return $user;
328+
return $this->userRepository->findByResetPasswordHash($hash);
341329
}
342330

343331
/**

0 commit comments

Comments
 (0)