File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -178,9 +178,15 @@ public function ratioOfMonth(): float
178178 */
179179 public function extend (self $ other ): self
180180 {
181+ $ newStart = min ($ this ->start , $ other ->start );
182+ $ newEnd = max ($ this ->end , $ other ->end );
183+
184+ if ($ newStart > $ newEnd ) {
185+ throw new InvalidArgumentException ('Cannot extend intervals: resulting interval would be invalid ' );
186+ }
181187 return new self (
182- min ( $ this -> start , $ other -> start ) ,
183- max ( $ this -> end , $ other -> end ) ,
188+ $ newStart ,
189+ $ newEnd ,
184190 );
185191 }
186192}
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ public function getUniqueString(): string
111111
112112 public function getUsageInterval (): UsageInterval
113113 {
114+ return $ this ->usageInterval ;
114115 }
115116
116117 public function calculatePrice ()
You can’t perform that action at this time.
0 commit comments