1 | <?php |
||
8 | class Mixed extends Money |
||
9 | { |
||
10 | /** |
||
11 | * @var int |
||
12 | */ |
||
13 | protected $decimals; |
||
14 | |||
15 | /** |
||
16 | * Constructor |
||
17 | * |
||
18 | * @param int $cents Amount of money in cents |
||
19 | * @param int $decimals Number of minor units |
||
20 | */ |
||
21 | 2 | public function __construct($cents, $decimals = 0) |
|
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | final public function getCurrency() |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 2 | final protected function getDecimals() |
|
42 | |||
43 | /** |
||
44 | * Returns the sum of this and an other amount of money |
||
45 | * |
||
46 | * @param Money $addend The addend |
||
47 | * |
||
48 | * @return Money The sum |
||
49 | */ |
||
50 | 3 | public function plus(Money $addend) |
|
56 | |||
57 | /** |
||
58 | * Returns the subtraction of this and an other amount of money |
||
59 | * |
||
60 | * @param Money $subtrahend The subtrahend |
||
61 | * |
||
62 | * @return Money The difference |
||
63 | */ |
||
64 | 1 | public function minus(Money $subtrahend) |
|
70 | |||
71 | /** |
||
72 | * Normalizes two amounts such that they have the same number of decimals |
||
73 | * |
||
74 | * @param Money $a |
||
75 | * @param Money $b |
||
76 | * |
||
77 | * @return array An array containing the two amounts and number of decimals |
||
78 | */ |
||
79 | 2 | protected static function normalizeDecimals(Money $a, Money $b) |
|
91 | } |
||
92 |