src/Money.php
public static function max(Money $money, Money ...$monies) : Money
    {
        $max = $money;

        foreach ($monies as $money) {
            if ($money->isGreaterThan($max)) {
                $max = $money;
            }
        }

        return $max;
    }
public static function max(Money $money, Money ...$monies) : Money
    {
        $max = $money;

        foreach ($monies as $money) {
            if ($money->isGreaterThan($max)) {
                $max = $money;
            }
        }

        return $max;
    }
public static function max ( Money $ money , Money ... $ monies ) : Money { $ max = $ money ; foreach ( $ monies as $ money ) { if ( $ money -> isGreaterThan ( $ max ) ) { $ max = $ money ; } } return $ max ; }
Returns the maximum of the given monies.

If several monies are equal to the maximum value, the first one is returned.

@param Money    $money  The first money.
@param Money ...$monies The subsequent monies.

@return Money

@throws MoneyMismatchException If all the monies are not in the same currency.
Returns the maximum of the given monies .