src/Dto/WorkExample/WorkExampleAddressWithDistanceDto.php line 10

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Dto\WorkExample;
  4. use JsonSerializable;
  5. use OpenApi\Annotations as OA;
  6. final class WorkExampleAddressWithDistanceDto implements JsonSerializable
  7. {
  8.     /**
  9.      * @OA\Property(
  10.      *     description="Идентификатор локации",
  11.      *     example=12345,
  12.      * )
  13.      */
  14.     private int $id;
  15.     /**
  16.      * @OA\Property(
  17.      *     description="Адрес",
  18.      *     example="г. Минск, ул. Захарова, д. 23",
  19.      * )
  20.      */
  21.     private string $address;
  22.     /**
  23.      * @OA\Property(
  24.      *     description="Рассстояние от пользователя в метрах",
  25.      *     example=6123,
  26.      *     nullable=true,
  27.      * )
  28.      */
  29.     private ?int $distance;
  30.     public function __construct(int $idstring $address, ?int $distance)
  31.     {
  32.         $this->id $id;
  33.         $this->address $address;
  34.         $this->distance $distance;
  35.     }
  36.     public function jsonSerialize(): array
  37.     {
  38.         return [
  39.             'id' => $this->id,
  40.             'address' => $this->address,
  41.             'distance' => $this->distance,
  42.         ];
  43.     }
  44. }