commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountedPriceDraftModel.php
1<?php
2
3declare(strict_types=1);
10
17use 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
55 public function getValue()
56 {
57 if (is_null($this->value)) {
59 $data = $this->raw(self::FIELD_VALUE);
60 if (is_null($data)) {
61 return null;
62 }
63
64 $this->value = MoneyModel::of($data);
65 }
66
67 return $this->value;
68 }
69
76 public function getDiscount()
77 {
78 if (is_null($this->discount)) {
80 $data = $this->raw(self::FIELD_DISCOUNT);
81 if (is_null($data)) {
82 return null;
83 }
84
85 $this->discount = ProductDiscountReferenceModel::of($data);
86 }
87
88 return $this->discount;
89 }
90
91
95 public function setValue(?Money $value): void
96 {
97 $this->value = $value;
98 }
99
104 {
105 $this->discount = $discount;
106 }
107}
__construct(?Money $value=null, ?ProductDiscountReference $discount=null)