Example #1
0
        /**
         *
         *
         * @since 1.1.3
         * */
        static function get_equipment_line_item($price, $unit, $start_timestamp, $end_timestamp)
        {
            switch ($unit) {
                case "per_day":
                    $diff = STDate::timestamp_diff_day($start_timestamp, $end_timestamp);
                    if (!$diff) {
                        $diff = 1;
                    }
                    return (double) $unit * $diff;
                    break;
                case "per_hour":
                    $diff = STDate::timestamp_diff($start_timestamp, $end_timestamp);
                    if (!$diff) {
                        $diff = 1;
                    }
                    return (double) $price * $diff;
                    break;
                default:
                    return (double) $price;
                    break;
            }
        }
    }
    $a = new STCars();
    $a->init();
}