1 | <?php |
||
19 | class DefaultCalculator extends CalculatorBase |
||
20 | { |
||
21 | |||
22 | |||
23 | |||
24 | /** |
||
25 | * returns true if a calculator is supported as determined by loaded server extensions |
||
26 | * |
||
27 | * @return bool |
||
28 | */ |
||
29 | public function isSupported() |
||
33 | |||
34 | |||
35 | |||
36 | /** |
||
37 | * adds the supplied Money amount to this Money amount |
||
38 | * and returns a new Money object |
||
39 | * |
||
40 | * @param float|int|string $amount |
||
41 | * @param float|int|string $amount_to_add |
||
42 | * @return string |
||
43 | */ |
||
44 | public function add($amount, $amount_to_add) |
||
48 | |||
49 | |||
50 | |||
51 | /** |
||
52 | * subtracts the supplied Money amount from this Money amount |
||
53 | * and returns a new Money object |
||
54 | * |
||
55 | * @param float|int|string $amount |
||
56 | * @param float|int|string $amount_to_subtract |
||
57 | * @return string |
||
58 | */ |
||
59 | public function subtract($amount, $amount_to_subtract) |
||
63 | |||
64 | |||
65 | |||
66 | /** |
||
67 | * multiplies this Money amount by the supplied $multiplier |
||
68 | * and returns a new Money object |
||
69 | * |
||
70 | * @param float|int|string $amount |
||
71 | * @param float|int|string $multiplier |
||
72 | * @param int $precision |
||
73 | * @param int $rounding_mode |
||
74 | * @return string |
||
75 | * @throws InvalidArgumentException |
||
76 | */ |
||
77 | public function multiply($amount, $multiplier, $precision = 3, $rounding_mode = Calculator::ROUND_HALF_UP) |
||
81 | |||
82 | |||
83 | |||
84 | /** |
||
85 | * divides this Money amount by the supplied $divisor |
||
86 | * and returns a new Money object |
||
87 | * |
||
88 | * @param float|int|string $amount |
||
89 | * @param float|int|string $divisor |
||
90 | * @param int $precision |
||
91 | * @param int $rounding_mode |
||
92 | * @return string |
||
93 | * @throws InvalidArgumentException |
||
94 | */ |
||
95 | public function divide($amount, $divisor, $precision = 3, $rounding_mode = Calculator::ROUND_HALF_UP) |
||
100 | |||
101 | |||
102 | |||
103 | } |
||
104 |