AuthenticationData.php
2 years ago
DonateControllerData.php
2 years ago
DonateFormRouteData.php
2 years ago
DonateRouteData.php
2 years ago
DonationConfirmationReceiptViewRouteData.php
2 years ago
DonationFormGoalData.php
2 years ago
DonationFormPreviewRouteData.php
2 years ago
DonationFormQueryData.php
2 years ago
DonationFormViewRouteData.php
2 years ago
LegacyPurchaseFormData.php
2 years ago
UserData.php
2 years ago
ValidationRouteData.php
2 years ago
UserData.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonationForms\DataTransferObjects; |
| 4 | |
| 5 | /** |
| 6 | * @since 3.0.0 |
| 7 | */ |
| 8 | class UserData |
| 9 | { |
| 10 | /** |
| 11 | * @var string |
| 12 | */ |
| 13 | public $firstName; |
| 14 | |
| 15 | /** |
| 16 | * @var string |
| 17 | */ |
| 18 | public $lastName; |
| 19 | |
| 20 | /** |
| 21 | * @var string |
| 22 | */ |
| 23 | public $email; |
| 24 | |
| 25 | /** |
| 26 | * Convert data from user into DTO |
| 27 | * |
| 28 | * @since 3.0.0 |
| 29 | */ |
| 30 | public static function fromUser(\WP_User $user): self |
| 31 | { |
| 32 | $self = new self(); |
| 33 | |
| 34 | $self->firstName = $user->user_firstname; |
| 35 | $self->lastName = $user->user_lastname; |
| 36 | $self->email = $user->user_email; |
| 37 | |
| 38 | return $self; |
| 39 | } |
| 40 | } |
| 41 |