for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace MichaelRubel\Formatters\Collection;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use MichaelRubel\Formatters\Formatter;
class MaskStringFormatter implements Formatter
{
/**
* @var string
*/
public string $character = '*';
* @var int
public int $index = 4;
public int $length = -4;
public string $encoding = 'UTF-8';
* Format email as masked.
*
* @param Collection $items
* @return string
public function format(Collection $items): string
return Str::mask(
(string) $items->first(),
$this->character,
$this->index,
$this->length,
$this->encoding
);
}