Skip to content

Commit 0a9b622

Browse files
authored
Fix example
1 parent 42ab843 commit 0a9b622

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ use DirectoryTree\PrivacyFilter\Facades\PrivacyFilter;
123123

124124
$text = 'Contact John Doe at jdoe@example.com or 555-0100.';
125125

126+
// Find personal information.
126127
$entities = PrivacyFilter::entities($text);
127128

128-
$redacted = str($entities)->reduce(
129-
fn ($text, $entity) => str_replace($entity->text, '[redacted]', $text),
130-
$text,
131-
);
132-
133-
echo $redacted;
129+
// Redact detected entities.
130+
$redacted = collect($entities)->reduce(function (string $text, $entity) {
131+
return str_replace($entity->text, '[redacted]', $text);
132+
}, $text);
134133

135134
// Contact [redacted] at [redacted] or [redacted].
135+
echo $redacted;
136136
```
137137

138138
## Thresholds

0 commit comments

Comments
 (0)