src/Response/Beauty/Offer/MasterLocationResponse.php line 10

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Response\Beauty\Offer;
  4. use OpenApi\Annotations as OA;
  5. use JsonSerializable;
  6. final class MasterLocationResponse implements JsonSerializable
  7. {
  8.     /**
  9.      * @OA\Property(
  10.      *     property="locationId",
  11.      *     type="integer",
  12.      *     description="Идентификатор локации",
  13.      *     example=1234,
  14.      * )
  15.      */
  16.     private int $locationId;
  17.     /**
  18.      * @OA\Property(
  19.      *     property="name",
  20.      *     type="string",
  21.      *     description="Название локации",
  22.      *     example="Название локации",
  23.      * )
  24.      */
  25.     private string $name;
  26.     /**
  27.      * @OA\Property(
  28.      *     property="phones",
  29.      *     type="array",
  30.      *     description="Телефоны",
  31.      *     @OA\Items(type="string"),
  32.      * )
  33.      */
  34.     private array $phones;
  35.     /**
  36.      * @OA\Property(
  37.      *     description="Рассстояние от пользователя в метрах",
  38.      *     example=6123,
  39.      *     nullable=true,
  40.      * )
  41.      */
  42.     private ?int $distance;
  43.     private ?float $latitude;
  44.     private ?float $longitude;
  45.     public function __construct(
  46.         int $locationId,
  47.         string $name,
  48.         array $phones,
  49.         ?float $latitude null,
  50.         ?float $longitude null,
  51.         ?int $distance null
  52.     ) {
  53.         $this->locationId $locationId;
  54.         $this->name $name;
  55.         $this->phones $phones;
  56.         $this->latitude $latitude;
  57.         $this->longitude $longitude;
  58.         $this->distance $distance;
  59.     }
  60.     public function getLocationId(): int
  61.     {
  62.         return $this->locationId;
  63.     }
  64.     public function getName(): string
  65.     {
  66.         return $this->name;
  67.     }
  68.     public function getPhones(): array
  69.     {
  70.         return $this->phones;
  71.     }
  72.     public function getDistance(): ?int
  73.     {
  74.         return $this->distance;
  75.     }
  76.     public function getLatitude(): ?float
  77.     {
  78.         return $this->latitude;
  79.     }
  80.     public function getLongitude(): ?float
  81.     {
  82.         return $this->longitude;
  83.     }
  84.     public function updateDistance(?int $distance): void
  85.     {
  86.         $this->distance $distance;
  87.     }
  88.     public function jsonSerialize(): array
  89.     {
  90.         return [
  91.             'locationId' => $this->locationId,
  92.             'name' => $this->name,
  93.             'phones' => $this->phones,
  94.             'distance' => $this->distance,
  95.             'latitude' => $this->latitude,
  96.             'longitude' => $this->longitude,
  97.         ];
  98.     }
  99. }