PHP Class Dumplie\SharedKernel\Domain\Money\Price

显示文件 Open project: dumplie/dumplie Class Usage Examples

Public Methods

Method Description
__callStatic ( $method, $arguments ) : Price
__construct ( integer $amount, string $currency, integer $precision = self::DEFAULT_PRECISION )
add ( Price $addend ) : Price
amount ( ) : integer
currency ( ) : string
floatValue ( ) : float
fromInt ( integer $value, string $currency ) : Price
hasCurrency ( string $currency ) : boolean
hasSameCurrency ( Price $price ) : boolean
multiply ( integer $multiplier ) : Price
precision ( ) : integer

Method Details

__callStatic() public static method

public static __callStatic ( $method, $arguments ) : Price
$method
$arguments
return Price

__construct() public method

public __construct ( integer $amount, string $currency, integer $precision = self::DEFAULT_PRECISION )
$amount integer Amount, expressed in the smallest units of $currency (eg cents)
$currency string
$precision integer used to calculate float value, 10000 cents / 100 = 100.00

add() public method

public add ( Price $addend ) : Price
$addend Price
return Price

amount() public method

public amount ( ) : integer
return integer

currency() public method

public currency ( ) : string
return string

floatValue() public method

public floatValue ( ) : float
return float

fromInt() public static method

public static fromInt ( integer $value, string $currency ) : Price
$value integer
$currency string
return Price

hasCurrency() public method

public hasCurrency ( string $currency ) : boolean
$currency string
return boolean

hasSameCurrency() public method

public hasSameCurrency ( Price $price ) : boolean
$price Price
return boolean

multiply() public method

public multiply ( integer $multiplier ) : Price
$multiplier integer
return Price

precision() public method

public precision ( ) : integer
return integer