From 9e81d3dc40eca707c13af74a33e11ae5371cdef3 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Sat, 13 Jan 2018 13:08:18 -0500 Subject: [PATCH] Attempt anonymous Try anonymous function based on review suggestion. --- src/Core/UserImport.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index 3557b12cb..8b259b2db 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -155,9 +155,11 @@ class UserImport unset($account['user']['account_expires_on']); unset($account['user']['expire_notification_sent']); - foreach ($account['user'] as $k => &$v) { - $v = str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $v); - } + $callback = function ($key, $value) use ($oldbaseurl, $oldaddr, $newbaseurl, $newaddr) { + return str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $value); + }; + + $v = array_map($account['user'], $callback); // import user $r = self::dbImportAssoc('user', $account['user']);