Allow setting percent for fare overrides against base fare #125

This commit is contained in:
Nabeel Shahzad
2018-02-23 15:12:09 -06:00
parent dd144cc9bc
commit d5aef6fb87
7 changed files with 276 additions and 75 deletions

32
app/Support/Math.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Support;
/**
* Helper math
* @package App\Support
*/
class Math
{
/**
* Add/subtract a percentage to a number
* @param $number
* @param $percent
* @return float
*/
public static function addPercent($number, $percent): float
{
if(!is_numeric($number)) {
$number = (float) $number;
}
if(!is_numeric($percent)) {
$percent = (float) $percent;
}
return $number + ($number * ($percent/100));
}
}