commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DiscountedPriceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
26  protected $value;
27 
32  protected $discount;
33 
34 
38  public function __construct(
39  ?TypedMoney $value = null,
41  ) {
42  $this->value = $value;
43  $this->discount = $discount;
44  }
45 
50  public function getValue()
51  {
52  if (is_null($this->value)) {
54  $data = $this->raw(self::FIELD_VALUE);
55  if (is_null($data)) {
56  return null;
57  }
59  $this->value = $className::of($data);
60  }
61 
62  return $this->value;
63  }
64 
71  public function getDiscount()
72  {
73  if (is_null($this->discount)) {
75  $data = $this->raw(self::FIELD_DISCOUNT);
76  if (is_null($data)) {
77  return null;
78  }
79 
80  $this->discount = ProductDiscountKeyReferenceModel::of($data);
81  }
82 
83  return $this->discount;
84  }
85 
86 
90  public function setValue(?TypedMoney $value): void
91  {
92  $this->value = $value;
93  }
94 
99  {
100  $this->discount = $discount;
101  }
102 }
__construct(?TypedMoney $value=null, ?ProductDiscountKeyReference $discount=null)
setDiscount(?ProductDiscountKeyReference $discount)