您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

BalanceValue.php 459B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\ValueObjects;
  3. class BalanceValue
  4. {
  5. private int $value;
  6. private string $currency;
  7. public function __construct(int $value, string $currency = 'USD')
  8. {
  9. $this->value = $value;
  10. $this->currency = $currency;
  11. }
  12. public function getValue(): int
  13. {
  14. return $this->value;
  15. }
  16. public function formatted(): string
  17. {
  18. return money($this->value, $this->currency)->format();
  19. }
  20. }