当前位置: 首页>>代码示例>>PHP>>正文


PHP Tax::build方法代码示例

本文整理汇总了PHP中Tax::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Tax::build方法的具体用法?PHP Tax::build怎么用?PHP Tax::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tax的用法示例。


在下文中一共展示了Tax::build方法的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);
     }
 }
开发者ID:ayeo,项目名称:price,代码行数:33,代码来源:Price.php


注:本文中的Tax::build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。