commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
CartDiscount
CartDiscountPatternTargetModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\CartDiscount
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use stdClass;
16
20
final
class
CartDiscountPatternTargetModel
extends
JsonObjectModel
implements
CartDiscountPatternTarget
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
(
58
?
PatternComponentCollection
$triggerPattern
=
null
,
59
?
PatternComponentCollection
$targetPattern
=
null
,
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
109
return
$this->triggerPattern
;
110
}
111
119
public
function
getTargetPattern
()
120
{
121
if
(is_null($this->targetPattern)) {
123
$data = $this->
raw
(self::FIELD_TARGET_PATTERN);
124
if
(is_null($data)) {
125
return
null
;
126
}
127
$this->targetPattern =
PatternComponentCollection::fromArray
($data);
128
}
129
130
return
$this->targetPattern
;
131
}
132
140
public
function
getMaxOccurrence
()
141
{
142
if
(is_null($this->maxOccurrence)) {
144
$data = $this->
raw
(self::FIELD_MAX_OCCURRENCE);
145
if
(is_null($data)) {
146
return
null
;
147
}
148
$this->maxOccurrence = (int) $data;
149
}
150
151
return
$this->maxOccurrence
;
152
}
153
160
public
function
getSelectionMode
()
161
{
162
if
(is_null($this->selectionMode)) {
164
$data = $this->
raw
(self::FIELD_SELECTION_MODE);
165
if
(is_null($data)) {
166
return
null
;
167
}
168
$this->selectionMode = (string) $data;
169
}
170
171
return
$this->selectionMode
;
172
}
173
174
178
public
function
setTriggerPattern
(?
PatternComponentCollection
$triggerPattern
): void
179
{
180
$this->triggerPattern =
$triggerPattern
;
181
}
182
186
public
function
setTargetPattern
(?
PatternComponentCollection
$targetPattern
): void
187
{
188
$this->targetPattern =
$targetPattern
;
189
}
190
194
public
function
setMaxOccurrence
(?
int
$maxOccurrence
): void
195
{
196
$this->maxOccurrence =
$maxOccurrence
;
197
}
198
202
public
function
setSelectionMode
(?
string
$selectionMode
): void
203
{
204
$this->selectionMode =
$selectionMode
;
205
}
206
}
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel
Definition
CartDiscountPatternTargetModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\getType
getType()
Definition
CartDiscountPatternTargetModel.php:75
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\getTriggerPattern
getTriggerPattern()
Definition
CartDiscountPatternTargetModel.php:98
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\getTargetPattern
getTargetPattern()
Definition
CartDiscountPatternTargetModel.php:119
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\setTriggerPattern
setTriggerPattern(?PatternComponentCollection $triggerPattern)
Definition
CartDiscountPatternTargetModel.php:178
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\__construct
__construct(?PatternComponentCollection $triggerPattern=null, ?PatternComponentCollection $targetPattern=null, ?int $maxOccurrence=null, ?string $selectionMode=null, ?string $type=null)
Definition
CartDiscountPatternTargetModel.php:57
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\getMaxOccurrence
getMaxOccurrence()
Definition
CartDiscountPatternTargetModel.php:140
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\setMaxOccurrence
setMaxOccurrence(?int $maxOccurrence)
Definition
CartDiscountPatternTargetModel.php:194
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\$triggerPattern
$triggerPattern
Definition
CartDiscountPatternTargetModel.php:33
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\setTargetPattern
setTargetPattern(?PatternComponentCollection $targetPattern)
Definition
CartDiscountPatternTargetModel.php:186
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\$maxOccurrence
$maxOccurrence
Definition
CartDiscountPatternTargetModel.php:45
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition
CartDiscountPatternTargetModel.php:22
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\$type
$type
Definition
CartDiscountPatternTargetModel.php:27
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\$selectionMode
$selectionMode
Definition
CartDiscountPatternTargetModel.php:51
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\$targetPattern
$targetPattern
Definition
CartDiscountPatternTargetModel.php:39
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\getSelectionMode
getSelectionMode()
Definition
CartDiscountPatternTargetModel.php:160
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTargetModel\setSelectionMode
setSelectionMode(?string $selectionMode)
Definition
CartDiscountPatternTargetModel.php:202
Commercetools\Api\Models\CartDiscount\PatternComponentCollection
Definition
PatternComponentCollection.php:26
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\CartDiscount\CartDiscountPatternTarget
Definition
CartDiscountPatternTarget.php:15
Commercetools\Base\CSequence\fromArray
static fromArray(array $data)
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\CartDiscount
Definition
CartDiscount.php:9
Generated by
1.9.8