commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DirectDiscountModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\CartDiscount\CartDiscountTarget
;
12
use
Commercetools\Api\Models\CartDiscount\CartDiscountTargetModel
;
13
use
Commercetools\Api\Models\CartDiscount\CartDiscountValue
;
14
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueModel
;
15
use
Commercetools\Base\DateTimeImmutableCollection
;
16
use
Commercetools\Base\JsonObject
;
17
use
Commercetools\Base\JsonObjectModel
;
18
use
Commercetools\Base\MapperFactory
;
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
,
51
?
CartDiscountTarget
$target
=
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
}
92
$className =
CartDiscountValueModel::resolveDiscriminatorClass
($data);
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
}
114
$className =
CartDiscountTargetModel::resolveDiscriminatorClass
($data);
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
}
Commercetools\Api\Models\Cart\DirectDiscountModel
Definition:
DirectDiscountModel.php:25
Commercetools\Api\Models\Cart\DirectDiscountModel\getValue
getValue()
Definition:
DirectDiscountModel.php:84
Commercetools\Api\Models\Cart\DirectDiscountModel\$target
$target
Definition:
DirectDiscountModel.php:42
Commercetools\Api\Models\Cart\DirectDiscountModel\setTarget
setTarget(?CartDiscountTarget $target)
Definition:
DirectDiscountModel.php:141
Commercetools\Api\Models\Cart\DirectDiscountModel\$value
$value
Definition:
DirectDiscountModel.php:36
Commercetools\Api\Models\Cart\DirectDiscountModel\setId
setId(?string $id)
Definition:
DirectDiscountModel.php:125
Commercetools\Api\Models\Cart\DirectDiscountModel\$id
$id
Definition:
DirectDiscountModel.php:30
Commercetools\Api\Models\Cart\DirectDiscountModel\getId
getId()
Definition:
DirectDiscountModel.php:64
Commercetools\Api\Models\Cart\DirectDiscountModel\getTarget
getTarget()
Definition:
DirectDiscountModel.php:106
Commercetools\Api\Models\Cart\DirectDiscountModel\setValue
setValue(?CartDiscountValue $value)
Definition:
DirectDiscountModel.php:133
Commercetools\Api\Models\Cart\DirectDiscountModel\__construct
__construct(?string $id=null, ?CartDiscountValue $value=null, ?CartDiscountTarget $target=null)
Definition:
DirectDiscountModel.php:48
Commercetools\Api\Models\CartDiscount\CartDiscountTargetModel
Definition:
CartDiscountTargetModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountTargetModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
CartDiscountTargetModel.php:77
Commercetools\Api\Models\CartDiscount\CartDiscountValueModel
Definition:
CartDiscountValueModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountValueModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
CartDiscountValueModel.php:75
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\Cart\DirectDiscount
Definition:
DirectDiscount.php:17
Commercetools\Api\Models\CartDiscount\CartDiscountTarget
Definition:
CartDiscountTarget.php:15
Commercetools\Api\Models\CartDiscount\CartDiscountValue
Definition:
CartDiscountValue.php:15
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1