src/Helper/Monetico/Request/OrderContextShoppingCartItem.php line 48

  1. <?php
  2. namespace App\Helper\Monetico\Request;
  3. class OrderContextShoppingCartItem implements \JsonSerializable
  4. {
  5.     /**
  6.      * @var ?string
  7.      */
  8.     private $name;
  9.     /**
  10.      * @var ?string
  11.      */
  12.     private $description;
  13.     /**
  14.      * @var ?string
  15.      */
  16.     private $productCode;
  17.     /**
  18.      * @var ?string
  19.      */
  20.     private $imageURL;
  21.     /**
  22.      * @var ?int
  23.      */
  24.     private $unitPrice;
  25.     /**
  26.      * @var ?int
  27.      */
  28.     private $quantity;
  29.     /**
  30.      * @var ?string
  31.      */
  32.     private $productSKU;
  33.     /**
  34.      * @var ?string
  35.      */
  36.     private $productRisk;
  37.     public function jsonSerialize()
  38.     {
  39.         return array_filter([
  40.             "name" => $this->getName(),
  41.             "description" => $this->getDescription(),
  42.             "productCode" => $this->getProductCode(),
  43.             "imageURL" => $this->getImageURL(),
  44.             "unitPrice" => $this->getUnitPrice(),
  45.             "quantity" => $this->getQuantity(),
  46.             "productSKU" => $this->getProductSKU(),
  47.             "productRisk" => $this->getProductRisk()
  48.         ], function ($value) {
  49.             return !is_null($value);
  50.         });
  51.     }
  52.     /**
  53.      * @return string|null
  54.      */
  55.     public function getName(): ?string
  56.     {
  57.         return $this->name;
  58.     }
  59.     /**
  60.      * @param string|null $name
  61.      */
  62.     public function setName(?string $name): void
  63.     {
  64.         $this->name $name;
  65.     }
  66.     /**
  67.      * @return string|null
  68.      */
  69.     public function getDescription(): ?string
  70.     {
  71.         return $this->description;
  72.     }
  73.     /**
  74.      * @param string|null $description
  75.      */
  76.     public function setDescription(?string $description): void
  77.     {
  78.         $this->description $description;
  79.     }
  80.     /**
  81.      * @return string|null
  82.      */
  83.     public function getProductCode(): ?string
  84.     {
  85.         return $this->productCode;
  86.     }
  87.     /**
  88.      * @param string|null $productCode
  89.      */
  90.     public function setProductCode(?string $productCode): void
  91.     {
  92.         $this->productCode $productCode;
  93.     }
  94.     /**
  95.      * @return string|null
  96.      */
  97.     public function getImageURL(): ?string
  98.     {
  99.         return $this->imageURL;
  100.     }
  101.     /**
  102.      * @param string|null $imageURL
  103.      */
  104.     public function setImageURL(?string $imageURL): void
  105.     {
  106.         $this->imageURL $imageURL;
  107.     }
  108.     /**
  109.      * @return int|null
  110.      */
  111.     public function getUnitPrice(): ?int
  112.     {
  113.         return $this->unitPrice;
  114.     }
  115.     /**
  116.      * @param int|null $unitPrice
  117.      */
  118.     public function setUnitPrice(?int $unitPrice): void
  119.     {
  120.         $this->unitPrice $unitPrice;
  121.     }
  122.     /**
  123.      * @return int|null
  124.      */
  125.     public function getQuantity(): ?int
  126.     {
  127.         return $this->quantity;
  128.     }
  129.     /**
  130.      * @param int|null $quantity
  131.      */
  132.     public function setQuantity(?int $quantity): void
  133.     {
  134.         $this->quantity $quantity;
  135.     }
  136.     /**
  137.      * @return string|null
  138.      */
  139.     public function getProductSKU(): ?string
  140.     {
  141.         return $this->productSKU;
  142.     }
  143.     /**
  144.      * @param string|null $productSKU
  145.      */
  146.     public function setProductSKU(?string $productSKU): void
  147.     {
  148.         $this->productSKU $productSKU;
  149.     }
  150.     /**
  151.      * @return string|null
  152.      */
  153.     public function getProductRisk(): ?string
  154.     {
  155.         return $this->productRisk;
  156.     }
  157.     /**
  158.      * @param string|null $productRisk
  159.      */
  160.     public function setProductRisk(?string $productRisk): void
  161.     {
  162.         $this->productRisk $productRisk;
  163.     }
  164. }