Skip to content

Commit

Permalink
Fix support for short phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Mar 23, 2023
1 parent 9bae3b7 commit dd2c72c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lhc_web/lib/vendor_lhc/LiveHelperChat/Helpers/Anonymizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
class Anonymizer
{
public static function maskPhone($phone) {

if (strlen($phone) <= 4) {
return $phone;
}

$hasSign = strpos($phone,'+') !== false ? '+' : '';
return $hasSign . str_repeat('*', strlen($phone) - (4 + ($hasSign != '' ? 1 : 0)) ) . mb_substr($phone,strlen($phone)-4);

$length = strlen($phone) - (4 + ($hasSign != '' ? 1 : 0));

return $hasSign . str_repeat('*', $length) . mb_substr($phone,strlen($phone)-4);

}

public static function maskEmail($email, $minLength = 3, $maxLength = 10, $mask = "***") {
Expand Down

0 comments on commit dd2c72c

Please sign in to comment.