commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartDiscountValueFixedDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
22 {
23  public const DISCRIMINATOR_VALUE = 'fixed';
28  protected $type;
29 
34  protected $money;
35 
36 
40  public function __construct(
41  ?MoneyCollection $money = null,
42  ?string $type = null
43  ) {
44  $this->money = $money;
45  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
46  }
47 
52  public function getType()
53  {
54  if (is_null($this->type)) {
56  $data = $this->raw(self::FIELD_TYPE);
57  if (is_null($data)) {
58  return null;
59  }
60  $this->type = (string) $data;
61  }
62 
63  return $this->type;
64  }
65 
74  public function getMoney()
75  {
76  if (is_null($this->money)) {
78  $data = $this->raw(self::FIELD_MONEY);
79  if (is_null($data)) {
80  return null;
81  }
82  $this->money = MoneyCollection::fromArray($data);
83  }
84 
85  return $this->money;
86  }
87 
88 
92  public function setMoney(?MoneyCollection $money): void
93  {
94  $this->money = $money;
95  }
96 }