Пример #1
0
 public function addMoney(Money $m)
 {
     if ($this->currency() == $m->currency()) {
         return new Money($this->amount() + $m->amount(), $this->currency());
     }
     return MoneyBag::create($this, $m);
 }
Пример #2
0
 public function testSimpleBagAdd()
 {
     // [14 EUR] + {[12 EUR][7 USD]} == {[26 EUR][7 USD]}
     $expected = MoneyBag::create(new Money(26, 'EUR'), new Money(7, 'USD'));
     $this->assertTrue($expected->equals($this->f14EUR->add($this->fMB1)));
 }
Пример #3
0
 public function addMoneyBag(MoneyBag $s)
 {
     return MoneyBag::create($s, $this);
 }