| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 81.82% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | class Amount implements IAmount |
||
| 23 | { |
||
| 24 | private int $amount; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @deprecated use \Pixidos\GPWebPay\Param\AmountInPennies instead |
||
| 28 | * Amount constructor. |
||
| 29 | * |
||
| 30 | * @param float $amount |
||
| 31 | * @param bool $converToPennies |
||
| 32 | * |
||
| 33 | * @throws InvalidArgumentException |
||
| 34 | */ |
||
| 35 | 3 | public function __construct(float $amount, bool $converToPennies = true) |
|
| 36 | { |
||
| 37 | // prevod na halere/centy |
||
| 38 | 3 | if ($converToPennies) { |
|
| 39 | 2 | $amount *= 100; |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | assertIsInteger($amount, 'AMOUNT'); |
|
| 43 | |||
| 44 | 2 | $this->amount = (int)$amount; |
|
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | public function getParamName(): string |
||
| 52 | { |
||
| 53 | return Param::AMOUNT; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return int |
||
| 58 | */ |
||
| 59 | 2 | public function getValue(): int |
|
| 62 | } |
||
| 63 | |||
| 64 | |||
| 65 | /** |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | 2 | public function __toString(): string |
|
| 73 |