GoalSettings.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonationForms\Properties; |
| 4 | |
| 5 | use Give\DonationForms\ValueObjects\GoalType; |
| 6 | |
| 7 | /** |
| 8 | * @since 4.3.0 |
| 9 | */ |
| 10 | class GoalSettings |
| 11 | { |
| 12 | public string $goalSource; |
| 13 | public float $goalAmount; |
| 14 | public GoalType $goalType; |
| 15 | public bool $enableDonationGoal; |
| 16 | |
| 17 | public static function fromArray(array $data): GoalSettings |
| 18 | { |
| 19 | $settings = new self(); |
| 20 | $settings->goalSource = $data['goalSource']; |
| 21 | $settings->enableDonationGoal = $data['enableDonationGoal']; |
| 22 | $settings->goalType = new GoalType($data['goalType']); |
| 23 | $settings->goalAmount = $data['goalAmount']; |
| 24 | |
| 25 | return $settings; |
| 26 | } |
| 27 | } |
| 28 |