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

Add ArrayHelper::restrictedMerge() #139

Merged
merged 7 commits into from
Dec 8, 2023
Merged

Add ArrayHelper::restrictedMerge() #139

merged 7 commits into from
Dec 8, 2023

Conversation

vjik
Copy link
Member

@vjik vjik commented Dec 7, 2023

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Copy link

what-the-diff bot commented Dec 7, 2023

PR Summary

  • Added a new method for merging arrays
    A new method named restrictedMerge() has been introduced that can merge multiple arrays together, layer by layer, till a specified depth. This method combines elements with matching string keys and appends elements with number keys. We've also made sure to test this new functionality through various unit tests.

  • Enhanced the existing method for merging arrays
    The previous merge() method has now been upgraded to use a new auxiliary method named doMerge(). This makes the code more streamlined and easier to maintain.

  • Introduced a supporting helper method
    A new helper method doMerge() has been added, tasked with handling the complex logic of merging operations. This method is leveraged by both merge() and restrictedMerge() methods to execute their tasks.

  • Included multiple unit tests
    Added an extensive set of unit tests for the restrictedMerge() method. These tests put the method under different conditions to ensure it works consistently and reliably.

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3e9640a) 99.75% compared to head (b0c65e3) 99.76%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #139   +/-   ##
=========================================
  Coverage     99.75%   99.76%           
- Complexity      208      212    +4     
=========================================
  Files             4        4           
  Lines           415      422    +7     
=========================================
+ Hits            414      421    +7     
  Misses            1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vjik vjik requested a review from a team December 7, 2023 08:26
@vjik vjik added the status:code review The pull request needs review. label Dec 7, 2023
src/ArrayHelper.php Outdated Show resolved Hide resolved
src/ArrayHelper.php Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Sergei Tigrov <rrr-r@ya.ru>
@vjik vjik merged commit 98d7e70 into master Dec 8, 2023
18 of 19 checks passed
@vjik vjik deleted the merge-depth branch December 8, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants