本文整理汇总了PHP中Tax::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Tax::validate方法的具体用法?PHP Tax::validate怎么用?PHP Tax::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tax
的用法示例。
在下文中一共展示了Tax::validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @deprecated: Constructor will be private within few next releases
* It is not possible to calculate correct tax rate for a given nett and gross
* Dedicated class will be introduced to allow building price with these data but
* acquiring tax value will be prohibited
*
* Building price is only possible using:
* - buildByGross()
* - buildByNett()
* - buildEmpty()
*
* @param float $nett
* @param float $gross
* @param string $currencySymbol
*/
public function __construct($nett = 0.0, $gross = 0.0, $currencySymbol, $tax = null)
{
//var_dump($tax);
//todo: check tax
$this->currency = new Currency($currencySymbol);
$this->nett = new Money($nett);
$this->gross = new Money($gross);
if ($this->nett->isGreaterThan($this->gross)) {
throw new \LogicException('Nett must not be greater than gross');
}
if (is_null($tax)) {
$this->tax = Tax::build($nett, $gross);
$this->mixedTax = true;
} else {
$this->tax = new Tax($tax);
$this->tax->validate($nett, $gross);
}
}