Skip to content
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

Refactor OpenPDF for Improved Code Maintainability: Encapsulation, Factory Method, and Utility Class Extraction #1241

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

samruddhithakor
Copy link

@samruddhithakor samruddhithakor commented Nov 27, 2024

Description of the new Feature/Bugfix

This pull request improves maintainability and reduces redundancy in the OpenPDF project through the following refactorings:

  1. Pull-Up Method: Moved setTemplateData to the Image superclass to handle PdfTemplate initialization generically and reduce duplication.
  2. Factory Method: Added createFromTemplate in Image for streamlined and centralized creation of Image objects from PdfTemplate.
  3. Extract Class: Extracted processParameters logic from ImgWMF to a new utility class, WMFProcessor, and introduced WMFData to encapsulate parameters. Simplified ImgWMF to delegate responsibilities to WMFProcessor.

Related Issue: #

Unit-Tests for the new Feature/Bugfix

  • Added tests for WMFProcessor to validate processParameters.
  • Updated tests for createFromTemplate.

Compatibilities Issues

No breaking changes. Refactored code maintains backward compatibility.

Your real name

Samruddhi Dharmeshkumar Thakor

Testing details

Verified WMFProcessor for correct parameter processing.
Tested createFromTemplate for proper initialization of Image objects.
Ran all existing tests to confirm no regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant