commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DirectDiscountModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class DirectDiscountModel extends JsonObjectModel implements DirectDiscount
25 {
30  protected $id;
31 
36  protected $value;
37 
42  protected $target;
43 
44 
48  public function __construct(
49  ?string $id = null,
50  ?CartDiscountValue $value = null,
52  ) {
53  $this->id = $id;
54  $this->value = $value;
55  $this->target = $target;
56  }
57 
64  public function getId()
65  {
66  if (is_null($this->id)) {
68  $data = $this->raw(self::FIELD_ID);
69  if (is_null($data)) {
70  return null;
71  }
72  $this->id = (string) $data;
73  }
74 
75  return $this->id;
76  }
77 
84  public function getValue()
85  {
86  if (is_null($this->value)) {
88  $data = $this->raw(self::FIELD_VALUE);
89  if (is_null($data)) {
90  return null;
91  }
93  $this->value = $className::of($data);
94  }
95 
96  return $this->value;
97  }
98 
106  public function getTarget()
107  {
108  if (is_null($this->target)) {
110  $data = $this->raw(self::FIELD_TARGET);
111  if (is_null($data)) {
112  return null;
113  }
115  $this->target = $className::of($data);
116  }
117 
118  return $this->target;
119  }
120 
121 
125  public function setId(?string $id): void
126  {
127  $this->id = $id;
128  }
129 
133  public function setValue(?CartDiscountValue $value): void
134  {
135  $this->value = $value;
136  }
137 
141  public function setTarget(?CartDiscountTarget $target): void
142  {
143  $this->target = $target;
144  }
145 }
__construct(?string $id=null, ?CartDiscountValue $value=null, ?CartDiscountTarget $target=null)