summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-07-09 11:58:14 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-07-09 19:29:14 +0200
commitd57540ac8460c746baf65323fa8af6db07a58db7 (patch)
treec7478a0e5a485c1c254f00f1fa05a2df86fc121b /core
parenteb092bbdc74fd10253e7a75850d5725df27daa25 (diff)
downloadnextcloud-server-d57540ac8460c746baf65323fa8af6db07a58db7.tar.gz
nextcloud-server-d57540ac8460c746baf65323fa8af6db07a58db7.zip
Return first value from $users
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'core')
-rw-r--r--core/Controller/LostController.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 96018555ec3..5ac0557e5d6 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -50,6 +50,9 @@ use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
+use function array_filter;
+use function count;
+use function reset;
/**
* Class LostController
@@ -389,12 +392,12 @@ class LostController extends Controller {
return $user;
}
- $users = \array_filter($this->userManager->getByEmail($input), function (IUser $user) {
+ $users = array_filter($this->userManager->getByEmail($input), function (IUser $user) {
return $user->isEnabled();
});
- if (\count($users) === 1) {
- return $users[0];
+ if (count($users) === 1) {
+ return reset($users);
}
throw $userNotFound;