src/Payum/Core/Security/Util/Mask.php
public static function mask($value, $maskSymbol = null, $showLast = 3)
    {
        $maskSymbol = $maskSymbol ?: 'X';
        $showLast = max(0, $showLast);

        if (mb_strlen($value) <= ($showLast + 1) * 2 || false == $showLast) {
            $showRegExpPart = "";
        } else {
            $showRegExpPart = "(?!(.){0,$showLast}$)";
        }

        return preg_replace("/(?!^.?)[^-_\s]$showRegExpPart/u", $maskSymbol, $value);
    }
public static function mask($value, $maskSymbol = null, $showLast = 3)
    {
        $maskSymbol = $maskSymbol ?: 'X';
        $showLast = max(0, $showLast);

        if (mb_strlen($value) <= ($showLast + 1) * 2 || false == $showLast) {
            $showRegExpPart = "";
        } else {
            $showRegExpPart = "(?!(.){0,$showLast}$)";
        }

        return preg_replace("/(?!^.?)[^-_\s]$showRegExpPart/u", $maskSymbol, $value);
    }
@param string $value
@param string $maskSymbol
@param int    $showLast

@return string