Свойство | Тип | Описание | |
---|---|---|---|
$amount | string | The money amount | |
$currency | The amount currency |
Метод | Описание | |
---|---|---|
__callStatic ( string $method, array $arguments ) : |
Convenience factory method for a Money object | |
add ( |
Returns a new Money object that represents the sum of this and another Money object | |
amount ( ) : string | Returns the value represented by this Money object | |
convertTo ( |
Converts the currency of this Money object to a given target currency with a given conversion rate | |
currency ( ) : |
Returns the currency of this Money object | |
divideBy ( numeric $divisor ) : |
Returns a new Money object that represents the divided value by the given factor | |
equals ( |
Checks whether the value represented by this object equals to the other | |
fromAmount ( numeric $amount, |
Creates a Money object from its amount and currency | |
hasSameCurrencyAs ( |
Checks whether a Money has the same Currency as this | |
isGreaterThan ( |
Checks whether the value represented by this object is greater than the other | |
isGreaterThanOrEqualTo ( |
||
isLessThan ( |
Checks whether the value represented by this object is less than the other | |
isLessThanOrEqualTo ( |
||
isNegative ( ) : boolean | Checks if the value represented by this object is negative | |
isPositive ( ) : boolean | Checks if the value represented by this object is positive | |
isZero ( ) : boolean | Checks if the value represented by this object is zero | |
multiplyBy ( numeric $multiplier ) : |
Returns a new Money object that represents the multiplied value by the given factor | |
round ( integer $scale ) : |
Rounds this Money to another scale | |
subtract ( |
Returns a new Money object that represents the difference of this and another Money object |
Метод | Описание | |
---|---|---|
__construct ( string $amount, |
||
assertNumeric ( numeric $value ) | Asserts that a value is a valid numeric string | |
assertSameCurrencyAs ( |
Asserts that a Money has the same currency as this | |
compareTo ( |
Returns an integer less than, equal to, or greater than zero if the value of this object is considered to be respectively less than, equal to, or greater than the other | |
compareTo0 ( ) : integer | Returns an integer less than, equal to, or greater than zero if the value of this object is considered to be respectively less than, equal to, or greater than 0 | |
newInstance ( string $amount ) : |
Returns a new Money instance based on the current one |
$fiveDollar = Money::USD(500);
public static __callStatic ( string $method, array $arguments ) : |
||
$method | string | |
$arguments | array | |
Результат |
public add ( |
||
$addend | ||
Результат |
public convertTo ( |
||
$targetCurrency | ||
$conversionRate | numeric | |
Результат |
public currency ( ) : |
||
Результат |
public divideBy ( numeric $divisor ) : |
||
$divisor | numeric | |
Результат |
public static fromAmount ( numeric $amount, |
||
$amount | numeric | |
$currency | ||
Результат |
public hasSameCurrencyAs ( |
||
$other | ||
Результат | boolean |
public isGreaterThan ( |
||
$other | ||
Результат | boolean |
public isGreaterThanOrEqualTo ( |
||
$other | ||
Результат | boolean |
public isLessThan ( |
||
$other | ||
Результат | boolean |
public isLessThanOrEqualTo ( |
||
$other | ||
Результат | boolean |
public isNegative ( ) : boolean | ||
Результат | boolean |
public isPositive ( ) : boolean | ||
Результат | boolean |
public multiplyBy ( numeric $multiplier ) : |
||
$multiplier | numeric | |
Результат |
public subtract ( |
||
$subtrahend | ||
Результат |