src/Dto/Tire/TireDto.php line 9

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Dto\Tire;
  4. use JsonSerializable;
  5. final class TireDto implements JsonSerializable
  6. {
  7.     private int $id;
  8.     private string $name;
  9.     private ?string $image;
  10.     private ?float $regularPrice;
  11.     private ?float $offerPrice;
  12.     private ?float $discount;
  13.     public function __construct(
  14.         int $id,
  15.         string $name,
  16.         ?string $image,
  17.         ?float $regularPrice,
  18.         ?float $offerPrice,
  19.         ?float $discount
  20.     ) {
  21.         $this->id $id;
  22.         $this->name $name;
  23.         $this->image $image;
  24.         $this->regularPrice $regularPrice;
  25.         $this->offerPrice $offerPrice;
  26.         $this->discount $discount;
  27.     }
  28.     public function getId(): int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getName(): string
  33.     {
  34.         return $this->name;
  35.     }
  36.     public function getImage(): ?string
  37.     {
  38.         return $this->image;
  39.     }
  40.     public function getRegularPrice(): ?float
  41.     {
  42.         return $this->regularPrice;
  43.     }
  44.     public function getOfferPrice(): ?float
  45.     {
  46.         return $this->offerPrice;
  47.     }
  48.     public function getDiscount(): ?float
  49.     {
  50.         return $this->discount;
  51.     }
  52.     public function jsonSerialize(): array
  53.     {
  54.         return [
  55.             'id' => $this->id,
  56.             'name' => $this->name,
  57.             'image' => $this->image,
  58.             'regularPrice' => $this->regularPrice,
  59.             'offerPrice' => $this->offerPrice,
  60.             'discount' => $this->discount,
  61.         ];
  62.     }
  63. }