100) { throw new \Exception('Invalid arg reduction'); } return (($price / 100) * (100 - $value)); } elseif ($type === 2) { if ($value < 0 || $value > $price * $quantity) { throw new \Exception('Invalid arg reduction'); } return ($price * $quantity - $value) / $quantity; } elseif ($type === 3) { if ($value < 0 || $value > $price) { throw new \Exception('Invalid arg reduction'); } return ($price - $value); } } }