-
-
Notifications
You must be signed in to change notification settings - Fork 101
[stable32] refactor: footer handler decoupling #5993
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
Merged
Merged
+328
−43
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Breaking changes:
- getFooter() now accepts only array $dimensions parameter
- UUID must be set via setTemplateVar('uuid', $uuid) before calling getFooter()
Changes:
- Remove FileEntity dependency from getFooter() signature
- Allow customization of all template variables via setTemplateVar()
- Only fetch default values from appConfig if not already customized
- Check if 'uuid' exists in templateVars before building validationSite
Benefits:
- Reduced coupling - no dependency on FileEntity
- More flexible - all variables customizable via same API
- Cleaner design - consistent use of setTemplateVar() for all variables
- Easier testing - no need to mock FileEntity
Signed-off-by: Vitor Mattos <[email protected]>
- Use setTemplateVar('uuid') to pass UUID to FooterHandler
- Call getFooter() with only dimensions parameter
- Maintains all existing functionality
Signed-off-by: Vitor Mattos <[email protected]>
- Use setTemplateVar('uuid') before calling getFooter()
- Remove FileEntity mock creation
- Simplify test setup
Signed-off-by: Vitor Mattos <[email protected]>
Only generate QR code if validationSite is available in templateVars. This prevents undefined array key error when uuid is not set. Signed-off-by: Vitor Mattos <[email protected]>
Add tests for specific edge cases: - testGetFooterWithoutUuid: ensures no error when uuid is not set - testCustomValidationSiteNotOverwritten: validates that custom validationSite set via setTemplateVar() is not overwritten by appConfig defaults These tests complement the existing dataProvider tests and ensure the refactored code handles edge cases properly. Signed-off-by: Vitor Mattos <[email protected]>
Introduces a type-safe collection class for footer template variables using magic methods (__call) with runtime type validation. Benefits: - Whitelist of allowed variables with expected types - Runtime type checking for all setters - Fluent interface for method chaining - Clean API with only ~70 lines of code - Prevents invalid variables or type mismatches Signed-off-by: Vitor Mattos <[email protected]>
Replace raw array with TemplateVariables class for better type safety and explicit contract of available template variables. Changes: - Use TemplateVariables instance instead of array - Replace array access with typed getters/setters - Maintain backward compatibility via setTemplateVar() - Improved code readability with explicit method names Signed-off-by: Vitor Mattos <[email protected]>
Add 21 tests with 53 assertions covering: - Setters/getters for all 9 variables (via DataProvider) - Null returns for unset variables - Array conversion and merge functionality - Whitelist validation (rejects unknown variables) - Type validation (rejects wrong types) - Invalid method calls Use PHP 8 attributes for DataProviders for cleaner syntax. Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of PR #5991