-
Notifications
You must be signed in to change notification settings - Fork 2
1155 anonymizer #1439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.x
Are you sure you want to change the base?
1155 anonymizer #1439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an Anonymizer transformer for the grid system that provides data anonymization capabilities for protecting sensitive information in grid views. It implements four different anonymization strategies: masking, initials conversion, partial reveal, and complete hiding.
- Adds a new
Anonymizer
transformer class with four anonymization rules - Registers the transformer in the service container
- Updates documentation with usage examples and configuration options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
File | Description |
---|---|
src/Grid/Column/Transformer/Anonymizer.php | Implements the core anonymization logic with mask, initials, partial, and hide strategies |
doc/03_Grid.md | Documents the transformer's configuration options and provides usage examples |
config/grid.yaml | Registers the new Anonymizer transformer as a tagged service |
$initials = []; | ||
|
||
foreach ($segments as $segment) { | ||
$parts = preg_split('/\s+/', trim($segment)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import for preg_split
function. Add use function preg_split;
to the function imports at the top of the file to follow the established pattern.
Copilot uses AI. Check for mistakes.
$initials[] = implode('.', array_map( | ||
static fn (string $part): string => mb_strtoupper(mb_substr($part, 0, 1)), | ||
array_filter($parts) | ||
)) . '.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing imports for implode
, array_map
, array_filter
, mb_strtoupper
, and mb_substr
functions. Add these to the function imports at the top of the file to follow the established pattern.
Copilot uses AI. Check for mistakes.
)) . '.'; | ||
} | ||
|
||
return implode(', ', $initials); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import for implode
function (if not already added from previous comment). Add use function implode;
to the function imports.
Copilot uses AI. Check for mistakes.
$minMaskLength = 3; | ||
$minDomainMaskLength = 5; | ||
|
||
if (!str_contains($value, '@')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import for str_contains
function. Add use function str_contains;
to the function imports at the top of the file to follow the established pattern.
Copilot uses AI. Check for mistakes.
} | ||
|
||
return implode(', ', $initials); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the unnecessary empty line before the closing brace to improve code consistency.
Copilot uses AI. Check for mistakes.
|
[Grid][Transformer] Anonymizer (Mask, Initial, Partial, Hide)