src/Dto/OnlineOrder/BuyerDto.php line 9

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Dto\OnlineOrder;
  4. use JsonSerializable;
  5. final class BuyerDto implements JsonSerializable
  6. {
  7.     private string $name;
  8.     private ?string $phone;
  9.     private ?string $email;
  10.     public function __construct(string $name, ?string $phone, ?string $email)
  11.     {
  12.         $this->name $name;
  13.         $this->phone $phone;
  14.         $this->email $email;
  15.     }
  16.     public function getName(): string
  17.     {
  18.         return $this->name;
  19.     }
  20.     public function getPhone(): ?string
  21.     {
  22.         return $this->phone;
  23.     }
  24.     public function getEmail(): ?string
  25.     {
  26.         return $this->email;
  27.     }
  28.     public function jsonSerialize(): array
  29.     {
  30.         return [
  31.             'name' => $this->name,
  32.             'phone' => $this->phone,
  33.             'email' => $this->email,
  34.         ];
  35.     }
  36. }