| 123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Data\Pagarme\Recipient\Parts\Request;
- use App\Data\Pagarme\PagarmeData;
- final readonly class PhoneData extends PagarmeData
- {
- public function __construct(
- public string $ddd,
- public string $number,
- public string $type,
- ) {
- self::requireFilled($this->ddd, 'phone.ddd');
- self::requireFilled($this->number, 'phone.number');
- self::requireIn($this->type, ['home', 'mobile'], 'phone.type');
- }
- public function toArray(): array
- {
- return $this->filterFilledRecursive([
- 'ddd' => $this->ddd,
- 'number' => $this->number,
- 'type' => $this->type,
- ]);
- }
- }
|