for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Sunfox\PriceCalculator\Discount;
use Nette\SmartObject;
use Sunfox\PriceCalculator\IDiscount;
/**
* @property float $value
*/
final class AmountDiscount implements IDiscount
{
use SmartObject;
public function __construct(
protected float $value = 0.0
) {
}
* Get discount value.
public function getValue(): float
return $this->value;
* Set discount value.
public function setValue(float $value): IDiscount
$this->value = $value;
return $this;
* Returns price after discount.
public function addDiscount(float $price): float
return $price - $this->value;
* Returns price before discount.
public function removeDiscount(float $price): float
return $price + $this->value;