refactor: make Acorn Socials package more modular#29
Open
dulgermuhammet wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the Acorn Socials package to be more modular by extracting shared repository logic into an abstract base class and shifting AcornSocials to depend on a repository interface, with optional hook registration.
Changes:
- Added
AbstractSectionRepositorywith common filtering methods (getSharableSocials(),getSocialPages()). - Expanded
SectionRepositoryInterfaceto cover all repository methods and updated signatures. - Updated
AcornSocialsto acceptSectionRepositoryInterfaceand allow a nullableHookManager.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Integrations/Customizer/SocialsSectionRepository.php | Removes duplicated filtering methods and relies on the new abstract base class. |
| src/Contracts/SectionRepositoryInterface.php | Updates the repository contract to include getData() and the derived filtering methods. |
| src/Concretes/AbstractSectionRepository.php | Introduces shared repository caching + filtering logic. |
| src/AcornSocials.php | Switches constructor dependency to the interface and makes hook registration conditional. |
| acorn-socials.php | Bumps plugin version to 0.6.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
why do we need this? |
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
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.
What type of PR is this? (check all applicable)
Description
This PR refactors the Acorn Socials package to make it more modular and reusable. The changes extract common repository functionality into an abstract base class and use dependency injection with interfaces rather than concrete implementations, allowing the package to be used independently of the Customizer integration.
Related Tickets & Documents
Changes
AbstractSectionRepositoryabstract class with common repository methods (getSharableSocials(),getSocialPages())SectionRepositoryInterfaceto include all repository method signaturesAcornSocialsto depend onSectionRepositoryInterfaceinstead of concreteSocialsSectionRepositoryHookManagernullable to allow flexible usage without requiring hook registrationSocialsSectionRepositoryby extending abstract classHookManageris providedImpact
Affected areas:
Breaking changes:
Database changes:
QA Instructions, Screenshots, Recordings
Testing instructions:
Verify existing Customizer integration continues to work:
Verify package can be used independently:
SectionRepositoryInterfaceimplementationAcornSocialswithoutHookManager(passnull)Run unit tests if available:
composer testCheck for PHP errors in logs after deployment
Tested on:
UI accessibility checklist
N/A - No UI changes
Deployment checklist
[optional] Are there any post-deployment tasks we need to perform?
No post-deployment tasks required.