/** * Returns the minimum of the given monies. * * If several monies are equal to the minimum value, the first one is returned. * * @param Money $money The first money. * @param Money ...$monies The subsequent monies. * * @return Money * * @throws CurrencyMismatchException If all the monies are not in the same currency. */ public static function min(Money $money, Money ...$monies) { $min = $money; foreach ($monies as $money) { if ($money->isLessThan($min)) { $min = $money; } } return $min; }