| 123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Data\Pagarme\Response\PagarmeCustomerResponseData\PagarmeCustomerPhonesResponseData;
- final readonly class PagarmeCustomerPhonesResponseData
- {
- public function __construct(
- public ?PagarmePhoneResponseData $homePhone,
- public ?PagarmePhoneResponseData $mobilePhone,
- ) {}
- public static function fromArray(?array $payload): self
- {
- return new self(
- homePhone: PagarmePhoneResponseData::fromArray($payload['home_phone'] ?? null),
- mobilePhone: PagarmePhoneResponseData::fromArray($payload['mobile_phone'] ?? null),
- );
- }
- public function toArray(): array
- {
- return array_filter([
- 'home_phone' => $this->homePhone?->toArray(),
- 'mobile_phone' => $this->mobilePhone?->toArray(),
- ]);
- }
- }
|