handleError(new Exception(sprintf("Discount type '%s' not supported", $type))); } $this->type = $type; if($type === self::TYPE_EXPRESSION_PRICE) { $this->value = !empty($value) ? esc_attr(trim($value)) : floatval($value); } else { $this->value = floatval($value); } $this->currencyCode = $context->getCurrencyCode(); } /** * @param string $type */ public function setType($type) { $this->type = $type; } /** * @param float $value */ public function setValue($value) { $this->value = floatval($value); } /** * @param string $currencyCode */ public function setCurrencyCode($currencyCode) { $this->currencyCode = $currencyCode; } /** * @return string */ public function getType() { return $this->type; } /** * @return float|string */ public function getValue() { return $this->value; } /** * @return string */ public function getCurrencyCode() { return $this->currencyCode; } }