프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$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 | ||
리턴 |