| @@ 210-221 (lines=12) @@ | ||
| 207 | * @return Money |
|
| 208 | * @throws InvalidArgumentException |
|
| 209 | */ |
|
| 210 | public function add(Money $other) |
|
| 211 | { |
|
| 212 | $this->verifySameCurrency($other->currency()); |
|
| 213 | return new Money( |
|
| 214 | $this->calculator()->add( |
|
| 215 | $this->amount(), |
|
| 216 | $other->amount() |
|
| 217 | ), |
|
| 218 | $this->currency(), |
|
| 219 | $this->calculator() |
|
| 220 | ); |
|
| 221 | } |
|
| 222 | ||
| 223 | ||
| 224 | ||
| @@ 233-244 (lines=12) @@ | ||
| 230 | * @return Money |
|
| 231 | * @throws InvalidArgumentException |
|
| 232 | */ |
|
| 233 | public function subtract(Money $other) |
|
| 234 | { |
|
| 235 | $this->verifySameCurrency($other->currency()); |
|
| 236 | return new Money( |
|
| 237 | $this->calculator()->subtract( |
|
| 238 | $this->amount(), |
|
| 239 | $other->amount() |
|
| 240 | ), |
|
| 241 | $this->currency(), |
|
| 242 | $this->calculator() |
|
| 243 | ); |
|
| 244 | } |
|
| 245 | ||
| 246 | ||
| 247 | /** |
|