From 45b747f13bd276a2245f6481c5377c1138b2d96d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 5 Jan 2020 13:05:00 +0000 Subject: [PATCH] Remove duplicates in a better way --- src/Model/UserItem.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Model/UserItem.php b/src/Model/UserItem.php index ab81be5e4c..fb89a9bc50 100644 --- a/src/Model/UserItem.php +++ b/src/Model/UserItem.php @@ -154,25 +154,19 @@ class UserItem continue; } - // Add the profile if it wasn't already added - if (!in_array($profile, $profiles)) { - $profiles[] = $profile; - } + // Add the profile + $profiles[] = $profile; // Add the normalized form $profile = Strings::normaliseLink($profile); - if (!in_array($profile, $profiles)) { - $profiles[] = $profile; - } + $profiles[] = $profile; // Add the SSL form $profile = str_replace('http://', 'https://', $profile); - if (!in_array($profile, $profiles)) { - $profiles[] = $profile; - } + $profiles[] = $profile; } - return $profiles; + return array_unique($profiles); } /**