Add Duration and Period value objects with associated arithmetic and validation.#4
Add Duration and Period value objects with associated arithmetic and validation.#4gustavofreze merged 1 commit intomainfrom
Conversation
…c and validation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dc290cc25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds new time value objects to the TinyBlocks\Time domain to support temporal arithmetic and interval modeling alongside Instant.
Changes:
- Introduces
Duration(unsigned seconds-based quantity) with arithmetic, comparisons, and unit conversions. - Introduces
Period(half-open interval[from, to)) with validation pluscontains()andoverlapsWith()logic. - Extends
Instantwithplus(),minus(),durationUntil(), and comparison helpers; updates tests and README accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Duration.php |
New Duration value object with factories, arithmetic, comparisons, conversions. |
src/Internal/Exceptions/InvalidDuration.php |
New exception type for invalid/negative duration operations. |
src/Period.php |
New Period value object with range validation and interval operations. |
src/Internal/Exceptions/InvalidPeriod.php |
New exception type for invalid periods (ordering / zero duration). |
src/Instant.php |
Adds duration arithmetic and comparison helpers to Instant. |
tests/DurationTest.php |
New unit tests covering Duration factories, arithmetic, comparisons, conversions. |
tests/PeriodTest.php |
New unit tests covering Period creation/validation, contains/overlaps, duration behavior. |
tests/InstantTest.php |
Adds coverage for new Instant arithmetic/comparison APIs. |
README.md |
Documents Duration, Period, and new Instant arithmetic/distance/comparison APIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.