commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DiscountedPriceDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $value;
29 
34  protected $discount;
35 
36 
40  public function __construct(
41  ?Money $value = null,
43  ) {
44  $this->value = $value;
45  $this->discount = $discount;
46  }
47 
54  public function getValue()
55  {
56  if (is_null($this->value)) {
58  $data = $this->raw(self::FIELD_VALUE);
59  if (is_null($data)) {
60  return null;
61  }
62 
63  $this->value = MoneyModel::of($data);
64  }
65 
66  return $this->value;
67  }
68 
75  public function getDiscount()
76  {
77  if (is_null($this->discount)) {
79  $data = $this->raw(self::FIELD_DISCOUNT);
80  if (is_null($data)) {
81  return null;
82  }
83 
84  $this->discount = ProductDiscountReferenceModel::of($data);
85  }
86 
87  return $this->discount;
88  }
89 
90 
94  public function setValue(?Money $value): void
95  {
96  $this->value = $value;
97  }
98 
103  {
104  $this->discount = $discount;
105  }
106 }
__construct(?Money $value=null, ?ProductDiscountReference $discount=null)