public function setDiscount($discount)
    {
        $discount = (float) $discount;

        if ($discount > 1) {
            $discount = min(max($discount, 0), 100);
            $discount = $discount / 100;
        }

        $this->set('discount', $discount);
    }
public function setDiscount($discount)
    {
        $discount = (float) $discount;

        if ($discount > 1) {
            $discount = min(max($discount, 0), 100);
            $discount = $discount / 100;
        }

        $this->set('discount', $discount);
    }
public function setDiscount ( $ discount ) { $ discount = ( float ) $ discount ; if ( $ discount > 1 ) { $ discount = min ( max ( $ discount , 0 ) , 100 ) ; $ discount = $ discount / 100 ; } $ this -> set ( 'discount' , $ discount ) ; }
Set the discount, if the discount value is adjusted to be within the range
of 0 and 100.

@param float $discount
Set the discount if the discount value is adjusted to be within the range of 0 and 100 .