Open Journal Systems  3.3.0
Money\Parser\DecimalMoneyParser Class Reference
Inheritance diagram for Money\Parser\DecimalMoneyParser:
Money\MoneyParser

Public Member Functions

 __construct (Currencies $currencies)
 
 parse ($money, $forceCurrency=null)
 

Data Fields

const DECIMAL_PATTERN = '/^(?P<sign>-)?(?P<digits>0|[1-9]\d*)?\.?(?P<fraction>\d+)?$/'
 

Detailed Description

Parses a decimal string into a Money object.

Author
Teoh Han Hui teohh.nosp@m.anhu.nosp@m.i@gma.nosp@m.il.c.nosp@m.om

Definition at line 17 of file DecimalMoneyParser.php.

Constructor & Destructor Documentation

◆ __construct()

Money\Parser\DecimalMoneyParser::__construct ( Currencies  $currencies)
Parameters
Currencies$currencies

Definition at line 32 of file DecimalMoneyParser.php.

Member Function Documentation

◆ parse()

Money\Parser\DecimalMoneyParser::parse (   $money,
  $forceCurrency = null 
)

{Parses a string into a Money object (including currency).

Parameters
string$money
Currency | string | null$forceCurrency
Returns
Money
Exceptions
Exception
}

Implements Money\MoneyParser.

Definition at line 40 of file DecimalMoneyParser.php.

References Money\Number\roundMoneyValue().

Field Documentation

◆ DECIMAL_PATTERN

const Money\Parser\DecimalMoneyParser::DECIMAL_PATTERN = '/^(?P<sign>-)?(?P<digits>0|[1-9]\d*)?\.?(?P<fraction>\d+)?$/'

Definition at line 19 of file DecimalMoneyParser.php.


The documentation for this class was generated from the following file: