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

Feature/adding method period substract #80

Merged

Conversation

Bibendus83
Copy link
Contributor

@Bibendus83 Bibendus83 commented Mar 15, 2019

This method allows to substract 2 Period objects like the difference operation in sets.
Compared to Period::diff, this method operation is not commutative and returns only one possible result.
image
The method returns a Sequence that can contain from 0 to 2 Period objects.

This method will be required in a future Sequence::substract method
For major details check ticket #78

@Bibendus83
Copy link
Contributor Author

If you confirm this PR I can go on with the Sequence::substract method that requires Period::substract.
I hoped to implement this function in a better way but I saw that the diff function is a bit more complicated than I tought so I decided to use it and filter the result I needed.

@nyamsprod nyamsprod merged commit 14d7f84 into thephpleague:master Mar 17, 2019
@nyamsprod
Copy link
Member

nyamsprod commented Mar 17, 2019

  • I've merge your PR
  • I've slightly updated your implementation to make it more readable IMHO
  • I've moved the tests to the proper subdirectory
  • I've used your illustration while adding the method to the package documentation

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.

2 participants