public function setUpgradeDiscount($discount)
    {
        if ($this->ordering <= 1) {
            $discount = 0;
        }

        $discount = (float) min(1, max(0, $discount));
        $this->setValue('upgrade_discount', $discount);

        return $this;
    }
public function setUpgradeDiscount($discount)
    {
        if ($this->ordering <= 1) {
            $discount = 0;
        }

        $discount = (float) min(1, max(0, $discount));
        $this->setValue('upgrade_discount', $discount);

        return $this;
    }
public function setUpgradeDiscount ( $ discount ) { if ( $ this -> ordering <= 1 ) { $ discount = 0 ; } $ discount = ( float ) min ( 1 , max ( 0 , $ discount ) ) ; $ this -> setValue ( 'upgrade_discount' , $ discount ) ; return $ this ; }
Set the upgrade discount to a value between 0 and 1.

@param float discount The discount amount
Set the upgrade discount to a value between 0 and 1 .