Open Monograph Press  3.3.0
Money\Calculator\BcMathCalculator Class Reference
Inheritance diagram for Money\Calculator\BcMathCalculator:
Money\Calculator

Public Member Functions

 __construct ($scale=14)
 
 absolute ($number)
 
 add ($amount, $addend)
 
 ceil ($number)
 
 compare ($a, $b)
 
 divide ($amount, $divisor)
 
 floor ($number)
 
 mod ($amount, $divisor)
 
 multiply ($amount, $multiplier)
 
 round ($number, $roundingMode)
 
 share ($amount, $ratio, $total)
 
 subtract ($amount, $subtrahend)
 

Static Public Member Functions

static supported ()
 

Detailed Description

Author
Frederik Bosch f.bos.nosp@m.ch@g.nosp@m.enkgo.nosp@m..nl

Definition at line 12 of file BcMathCalculator.php.

Constructor & Destructor Documentation

◆ __construct()

Money\Calculator\BcMathCalculator::__construct (   $scale = 14)
Parameters
int$scale

Definition at line 25 of file BcMathCalculator.php.

Member Function Documentation

◆ absolute()

Money\Calculator\BcMathCalculator::absolute (   $number)

{Returns the absolute value of the number.

Parameters
string$number
Returns
string
}

Implements Money\Calculator.

Definition at line 126 of file BcMathCalculator.php.

◆ add()

Money\Calculator\BcMathCalculator::add (   $amount,
  $addend 
)

{Add added to amount.

Parameters
string$amount
string$addend
Returns
string
}

Implements Money\Calculator.

Definition at line 49 of file BcMathCalculator.php.

References Money\Number\fromString().

◆ ceil()

Money\Calculator\BcMathCalculator::ceil (   $number)

{Round number to following integer.

Parameters
string$number
Returns
string
}

Implements Money\Calculator.

Definition at line 90 of file BcMathCalculator.php.

References Money\Number\fromNumber().

◆ compare()

Money\Calculator\BcMathCalculator::compare (   $a,
  $b 
)

{Compare a to b.

Parameters
string$a
string$b
Returns
int
}

Implements Money\Calculator.

Definition at line 41 of file BcMathCalculator.php.

◆ divide()

Money\Calculator\BcMathCalculator::divide (   $amount,
  $divisor 
)

{Divide amount with divisor.

Parameters
string$amount
int | float | string$divisor
Returns
string
}

Implements Money\Calculator.

Definition at line 80 of file BcMathCalculator.php.

References Money\Number\fromNumber().

◆ floor()

Money\Calculator\BcMathCalculator::floor (   $number)

{Round number to preceding integer.

Parameters
string$number
Returns
string
}

Implements Money\Calculator.

Definition at line 108 of file BcMathCalculator.php.

References Money\Number\fromNumber().

Referenced by Money\Calculator\BcMathCalculator\share().

◆ mod()

Money\Calculator\BcMathCalculator::mod (   $amount,
  $divisor 
)

{Get the modulus of an amount.

Parameters
string$amount
int | float | string$divisor
Returns
string
}

Implements Money\Calculator.

Definition at line 242 of file BcMathCalculator.php.

◆ multiply()

Money\Calculator\BcMathCalculator::multiply (   $amount,
  $multiplier 
)

{Multiply amount with multiplier.

Parameters
string$amount
int | float | string$multiplier
Returns
string
}

Implements Money\Calculator.

Definition at line 70 of file BcMathCalculator.php.

References Money\Number\fromNumber().

◆ round()

Money\Calculator\BcMathCalculator::round (   $number,
  $roundingMode 
)

{Round number, use rounding mode for tie-breaker.

Parameters
int | float | string$number
int$roundingMode
Returns
string
}

Implements Money\Calculator.

Definition at line 134 of file BcMathCalculator.php.

References Money\Number\fromNumber(), Money\Money\ROUND_HALF_DOWN, Money\Money\ROUND_HALF_EVEN, Money\Money\ROUND_HALF_NEGATIVE_INFINITY, Money\Money\ROUND_HALF_ODD, Money\Money\ROUND_HALF_POSITIVE_INFINITY, and Money\Money\ROUND_HALF_UP.

◆ share()

Money\Calculator\BcMathCalculator::share (   $amount,
  $ratio,
  $total 
)

{Share amount among ratio / total portions.

Parameters
string$amount
int | float | string$ratio
int | float | string$total
Returns
string
}

Implements Money\Calculator.

Definition at line 234 of file BcMathCalculator.php.

References Money\Calculator\BcMathCalculator\floor().

◆ subtract()

Money\Calculator\BcMathCalculator::subtract (   $amount,
  $subtrahend 
)

{Subtract subtrahend from amount.

Parameters
string$amount
string$subtrahend
Returns
string
}

Parameters
$amount
$subtrahend
Returns
string

Implements Money\Calculator.

Definition at line 62 of file BcMathCalculator.php.

References Money\Number\fromString().

◆ supported()

static Money\Calculator\BcMathCalculator::supported ( )
static

{Returns whether the calculator is supported in the current server environment.

Returns
bool
}

Implements Money\Calculator.

Definition at line 33 of file BcMathCalculator.php.


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