Skip to content

Commit 4dcb1d2

Browse files
committed
fix: Use named variables on sanitizing gmails
1 parent 2e5f201 commit 4dcb1d2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Helper/UserDataHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public function setEmail(string $email): bool
4242
substr($email, -mb_strlen("@gmail.com")) == "@gmail.com" ||
4343
substr($email, -mb_strlen("@googlemail.com")) == "@googlemail.com"
4444
) {
45-
$x = explode("@", $email, 2);
45+
[$addr, $host] = explode("@", $email, 2);
4646
// https://support.google.com/mail/thread/125577450/gmail-and-googlemail
47-
if ($x[1] == "googlemail.com") {
48-
$x[1] = "gmail.com";
47+
if ($host == "googlemail.com") {
48+
$host = "gmail.com";
4949
}
5050
// https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html
51-
$x[0] = explode("+", $x[0], 2)[0];
52-
$x[0] = str_replace(".", "", $x[0]);
53-
$email = implode("@", $x);
51+
$addr = explode("+", $addr, 2)[0];
52+
$addr = str_replace(".", "", $addr);
53+
$email = implode("@", [trim($addr), trim($host)]);
5454
}
5555

5656
$this->sha256_email_address = hash("sha256", $email);

0 commit comments

Comments
 (0)