@@ 243-255 (lines=13) @@ | ||
240 | * @return Money |
|
241 | * @throws InvalidArgumentException |
|
242 | */ |
|
243 | public function add(Money $other) |
|
244 | { |
|
245 | $this->verifySameCurrency($other->currency()); |
|
246 | return new Money( |
|
247 | $this->calculator()->add( |
|
248 | $this->amount(), |
|
249 | $other->amount() |
|
250 | ), |
|
251 | $this->currency(), |
|
252 | $this->calculator(), |
|
253 | $this->formatters() |
|
254 | ); |
|
255 | } |
|
256 | ||
257 | ||
258 | ||
@@ 267-279 (lines=13) @@ | ||
264 | * @return Money |
|
265 | * @throws InvalidArgumentException |
|
266 | */ |
|
267 | public function subtract(Money $other) |
|
268 | { |
|
269 | $this->verifySameCurrency($other->currency()); |
|
270 | return new Money( |
|
271 | $this->calculator()->subtract( |
|
272 | $this->amount(), |
|
273 | $other->amount() |
|
274 | ), |
|
275 | $this->currency(), |
|
276 | $this->calculator(), |
|
277 | $this->formatters() |
|
278 | ); |
|
279 | } |
|
280 | ||
281 | ||
282 |