MoneyParser
in package
FinalYes
Разбор суммы из десятичной записи основной единицы («10.50», «-1», «100» для йены).
Table of Contents
Properties
Methods
- __construct() : mixed
- parse() : Money
- assertPieces() : void
- assertShape() : void
- digits() : int
- parts() : array{whole: string, fraction: string}
- split() : array{whole: string, fraction: string, dot: int}
- toMinor() : int
Properties
$math read-only
private
IntegerMath
$math
Methods
__construct()
public
__construct(IntegerMath $math) : mixed
Parameters
- $math : IntegerMath
parse()
public
parse(string $amount, Currency $currency) : Money
Parameters
- $amount : string
- $currency : Currency
Tags
Return values
MoneyassertPieces()
private
assertPieces(string $whole, string $fraction, int $dot, int $exponent) : void
Parameters
- $whole : string
- $fraction : string
- $dot : int
- $exponent : int
Tags
assertShape()
private
assertShape(string $amount) : void
Parameters
- $amount : string
Tags
digits()
private
digits(string $digits) : int
Parameters
- $digits : string
Tags
Return values
intparts()
private
parts(string $amount, int $exponent) : array{whole: string, fraction: string}
Parameters
- $amount : string
- $exponent : int
Tags
Return values
array{whole: string, fraction: string}split()
private
split(string $amount) : array{whole: string, fraction: string, dot: int}
Parameters
- $amount : string
Return values
array{whole: string, fraction: string, dot: int}toMinor()
private
toMinor(string $amount, int $exponent) : int
Parameters
- $amount : string
- $exponent : int