commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartDiscountPatternTargetModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
22 public const DISCRIMINATOR_VALUE = 'pattern';
27 protected $type;
28
33 protected $triggerPattern;
34
39 protected $targetPattern;
40
45 protected $maxOccurrence;
46
51 protected $selectionMode;
52
53
57 public function __construct(
60 ?int $maxOccurrence = null,
61 ?string $selectionMode = null,
62 ?string $type = null
63 ) {
64 $this->triggerPattern = $triggerPattern;
65 $this->targetPattern = $targetPattern;
66 $this->maxOccurrence = $maxOccurrence;
67 $this->selectionMode = $selectionMode;
68 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
69 }
70
75 public function getType()
76 {
77 if (is_null($this->type)) {
79 $data = $this->raw(self::FIELD_TYPE);
80 if (is_null($data)) {
81 return null;
82 }
83 $this->type = (string) $data;
84 }
85
86 return $this->type;
87 }
88
98 public function getTriggerPattern()
99 {
100 if (is_null($this->triggerPattern)) {
102 $data = $this->raw(self::FIELD_TRIGGER_PATTERN);
103 if (is_null($data)) {
104 return null;
105 }
106 $this->triggerPattern = PatternComponentCollection::fromArray($data);
107 }
108
110 }
111
120 public function getTargetPattern()
121 {
122 if (is_null($this->targetPattern)) {
124 $data = $this->raw(self::FIELD_TARGET_PATTERN);
125 if (is_null($data)) {
126 return null;
127 }
128 $this->targetPattern = PatternComponentCollection::fromArray($data);
129 }
130
132 }
133
141 public function getMaxOccurrence()
142 {
143 if (is_null($this->maxOccurrence)) {
145 $data = $this->raw(self::FIELD_MAX_OCCURRENCE);
146 if (is_null($data)) {
147 return null;
148 }
149 $this->maxOccurrence = (int) $data;
150 }
151
153 }
154
161 public function getSelectionMode()
162 {
163 if (is_null($this->selectionMode)) {
165 $data = $this->raw(self::FIELD_SELECTION_MODE);
166 if (is_null($data)) {
167 return null;
168 }
169 $this->selectionMode = (string) $data;
170 }
171
173 }
174
175
180 {
181 $this->triggerPattern = $triggerPattern;
182 }
183
188 {
189 $this->targetPattern = $targetPattern;
190 }
191
195 public function setMaxOccurrence(?int $maxOccurrence): void
196 {
197 $this->maxOccurrence = $maxOccurrence;
198 }
199
203 public function setSelectionMode(?string $selectionMode): void
204 {
205 $this->selectionMode = $selectionMode;
206 }
207}
__construct(?PatternComponentCollection $triggerPattern=null, ?PatternComponentCollection $targetPattern=null, ?int $maxOccurrence=null, ?string $selectionMode=null, ?string $type=null)
static fromArray(array $data)