@@ 239-251 (lines=13) @@ | ||
236 | * @return Money |
|
237 | * @throws InvalidArgumentException |
|
238 | */ |
|
239 | public function add(Money $other) |
|
240 | { |
|
241 | $this->verifySameCurrency($other->currency()); |
|
242 | return new Money( |
|
243 | $this->calculator()->add( |
|
244 | $this->amount(), |
|
245 | $other->amount() |
|
246 | ), |
|
247 | $this->currency(), |
|
248 | $this->calculator(), |
|
249 | $this->formatters() |
|
250 | ); |
|
251 | } |
|
252 | ||
253 | ||
254 | ||
@@ 263-275 (lines=13) @@ | ||
260 | * @return Money |
|
261 | * @throws InvalidArgumentException |
|
262 | */ |
|
263 | public function subtract(Money $other) |
|
264 | { |
|
265 | $this->verifySameCurrency($other->currency()); |
|
266 | return new Money( |
|
267 | $this->calculator()->subtract( |
|
268 | $this->amount(), |
|
269 | $other->amount() |
|
270 | ), |
|
271 | $this->currency(), |
|
272 | $this->calculator(), |
|
273 | $this->formatters() |
|
274 | ); |
|
275 | } |
|
276 | ||
277 | ||
278 |