PHP 클래스 ValueObjects\Money\Money

상속: implements ValueObjects\ValueObjectInterface
파일 보기 프로젝트 열기: nicolopignatelli/valueobjects 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$currency ValueObjects\Money\Currency
$money Money\Money

공개 메소드들

메소드 설명
__construct ( integer $amount, ValueObjects\Money\Currency $currency ) Returns a Money object
__toString ( ) : string Returns a string representation of the Money value in format "CUR AMOUNT" (e.g.: EUR 1000)
add ( integer $quantity ) : Money Add an integer quantity to the amount and returns a new Money object.
fromNative ( ) : static Returns a Money object from native int amount and string currency code
getAmount ( ) : ValueObjects\Number\Integer Returns money amount
getCurrency ( ) : ValueObjects\Money\Currency Returns money currency
multiply ( ValueObjects\Number\Real $multiplier, ValueObjects\Number\RoundingMode $rounding_mode = null ) : Money Multiply the Money amount for a given number and returns a new Money object.
sameValueAs ( ValueObjects\ValueObjectInterface $money ) : boolean Tells whether two Currency are equal by comparing their amount and currency

메소드 상세

__construct() 공개 메소드

Returns a Money object
public __construct ( integer $amount, ValueObjects\Money\Currency $currency )
$amount integer Amount expressed in the smallest units of $currency (e.g. cents)
$currency ValueObjects\Money\Currency Currency of the money object

__toString() 공개 메소드

Returns a string representation of the Money value in format "CUR AMOUNT" (e.g.: EUR 1000)
public __toString ( ) : string
리턴 string

add() 공개 메소드

Use a negative quantity for subtraction.
public add ( integer $quantity ) : Money
$quantity integer Quantity to add
리턴 Money

fromNative() 공개 정적인 메소드

Returns a Money object from native int amount and string currency code
public static fromNative ( ) : static
리턴 static

getAmount() 공개 메소드

Returns money amount
public getAmount ( ) : ValueObjects\Number\Integer
리턴 ValueObjects\Number\Integer

getCurrency() 공개 메소드

Returns money currency
public getCurrency ( ) : ValueObjects\Money\Currency
리턴 ValueObjects\Money\Currency

multiply() 공개 메소드

Use 0 < Real $multipler < 1 for division.
public multiply ( ValueObjects\Number\Real $multiplier, ValueObjects\Number\RoundingMode $rounding_mode = null ) : Money
$multiplier ValueObjects\Number\Real
$rounding_mode ValueObjects\Number\RoundingMode Rounding mode of the operation. Defaults to RoundingMode::HALF_UP.
리턴 Money

sameValueAs() 공개 메소드

Tells whether two Currency are equal by comparing their amount and currency
public sameValueAs ( ValueObjects\ValueObjectInterface $money ) : boolean
$money ValueObjects\ValueObjectInterface
리턴 boolean

프로퍼티 상세

$currency 보호되어 있는 프로퍼티

protected Currency,ValueObjects\Money $currency
리턴 ValueObjects\Money\Currency

$money 보호되어 있는 프로퍼티

protected Money,Money $money
리턴 Money\Money