本文整理汇总了PHP中Money\Money::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Money::add方法的具体用法?PHP Money::add怎么用?PHP Money::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Money\Money
的用法示例。
在下文中一共展示了Money::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPlan
/**
* @param PlanDefinition $definition
* @param Money $amountToPay
* @param PlanParameters $parameters
* @internal param string $planCode
* @return \Ice\PaymentPlan\PaymentPlan
*/
public function getPlan(PlanDefinition $definition, Money $amountToPay, PlanParameters $parameters)
{
if ($parameters->hasParameter('bursary_total_deduction') && ($bursaryTotalDeduction = intval($parameters->get('bursary_total_deduction'))) > 0) {
$absoluteBursaryTotal = Money::GBP($bursaryTotalDeduction);
$amountBeforeBursary = $amountToPay->add($absoluteBursaryTotal);
$planWithoutBursary = $this->childCalculator->getPlan($definition, $amountBeforeBursary, $parameters);
return $this->subtractBursaryFromPlan($planWithoutBursary, $absoluteBursaryTotal);
}
return $this->childCalculator->getPlan($definition, $amountToPay, $parameters);
}
示例2: testDifferentCurrenciesCannotBeAdded
/**
* @expectedException Money\InvalidArgumentException
*/
public function testDifferentCurrenciesCannotBeAdded()
{
$m1 = new Money(100, new Currency('EUR'));
$m2 = new Money(100, new Currency('USD'));
$m1->add($m2);
}
示例3: addToAmount
public function addToAmount(Money $money)
{
return new static($this->amount->add($money), $this->dueDate);
}
示例4: testDifferentCurrenciesCannotBeAdded
/**
* @expectedException InvalidArgumentException
*/
public function testDifferentCurrenciesCannotBeAdded()
{
$m1 = new Money(100, CurrencyProxy::determine('EUR'));
$m2 = new Money(100, CurrencyProxy::determine('USD'));
$m1->add($m2);
}
示例5: add
/**
* @param Money $amount
*
* @throws \InvalidArgumentException
*
* @return Money
*/
public function add(Money $amount) : Money
{
return new self($this->money->add($amount->wrapped()));
}
示例6: deposit
/**
* Increase this account current balance
*
* @param Money $amount
*/
public function deposit(Money $amount)
{
$this->balance = $this->balance->add($amount);
}