| 1: | <?php |
| 2: | |
| 3: | namespace IPay\ValueObjects; |
| 4: | |
| 5: | use EventSauce\ObjectHydrator\Constructor; |
| 6: | |
| 7: | readonly class AccountState |
| 8: | { |
| 9: | private function __construct( |
| 10: | public int $availableBalance, |
| 11: | public int $balance, |
| 12: | ) { |
| 13: | } |
| 14: | |
| 15: | #[Constructor] |
| 16: | public static function create( |
| 17: | int $availableBalance, |
| 18: | int $balance, |
| 19: | ): self { |
| 20: | return new self( |
| 21: | $availableBalance, |
| 22: | $balance, |
| 23: | ); |
| 24: | } |
| 25: | } |
| 26: |