示例#1
0
 /**
  * Set currency value, upscaling into an integer for internal storage
  *
  * @param numeric|NumericType $value
  *
  * @return Fluent Interface
  * @throws \InvalidArgumentException
  */
 public function setAsFloat($value)
 {
     if (!(is_numeric($value) || $value instanceof NumericTypeInterface)) {
         throw new \InvalidArgumentException('value is not numeric');
     }
     $val = is_object($value) ? $value->asFloatType()->get() : floatval($value);
     $intVal = pow(10, $this->precision->get()) * $val;
     parent::set($intVal);
     return $this;
 }