| Total Complexity | 3 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class FormatDollars extends Action |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var float |
||
| 11 | */ |
||
| 12 | private $amount; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var int |
||
| 16 | */ |
||
| 17 | private $decimals; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | private $thousands_sep; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var bool |
||
| 26 | */ |
||
| 27 | private $dollar_sign_prefix; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * FormatDollars constructor. |
||
| 31 | * |
||
| 32 | * @param float $amount |
||
| 33 | * @param int $decimals |
||
| 34 | * @param string $thousands_sep |
||
| 35 | * @param bool $dollar_sign_prefix |
||
| 36 | */ |
||
| 37 | public function __construct(float $amount, |
||
| 38 | int $decimals = 2, |
||
| 39 | string $thousands_sep = '', |
||
| 40 | bool $dollar_sign_prefix = false) |
||
| 41 | { |
||
| 42 | $this->amount = $amount; |
||
| 43 | $this->decimals = $decimals; |
||
| 44 | $this->thousands_sep = $thousands_sep; |
||
| 45 | $this->dollar_sign_prefix = $dollar_sign_prefix; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Format a currency float value to a standard format. |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function execute(): string |
||
| 60 | } |
||
| 61 | } |
||
| 62 |