commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DirectDiscountDraftModel.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\CartDiscountValueDraft
;
14
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftModel
;
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
DirectDiscountDraftModel
extends
JsonObjectModel
implements
DirectDiscountDraft
25
{
30
protected
$value
;
31
36
protected
$target
;
37
38
42
public
function
__construct
(
43
?
CartDiscountValueDraft
$value
=
null
,
44
?
CartDiscountTarget
$target
=
null
45
) {
46
$this->value =
$value
;
47
$this->target =
$target
;
48
}
49
56
public
function
getValue
()
57
{
58
if
(is_null($this->value)) {
60
$data = $this->
raw
(self::FIELD_VALUE);
61
if
(is_null($data)) {
62
return
null
;
63
}
64
$className =
CartDiscountValueDraftModel::resolveDiscriminatorClass
($data);
65
$this->value = $className::of($data);
66
}
67
68
return
$this->value
;
69
}
70
78
public
function
getTarget
()
79
{
80
if
(is_null($this->target)) {
82
$data = $this->
raw
(self::FIELD_TARGET);
83
if
(is_null($data)) {
84
return
null
;
85
}
86
$className =
CartDiscountTargetModel::resolveDiscriminatorClass
($data);
87
$this->target = $className::of($data);
88
}
89
90
return
$this->target
;
91
}
92
93
97
public
function
setValue
(?
CartDiscountValueDraft
$value
): void
98
{
99
$this->value =
$value
;
100
}
101
105
public
function
setTarget
(?
CartDiscountTarget
$target
): void
106
{
107
$this->target =
$target
;
108
}
109
}
Commercetools\Api\Models\Cart\DirectDiscountDraftModel
Definition:
DirectDiscountDraftModel.php:25
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\$value
$value
Definition:
DirectDiscountDraftModel.php:30
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\getTarget
getTarget()
Definition:
DirectDiscountDraftModel.php:78
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\getValue
getValue()
Definition:
DirectDiscountDraftModel.php:56
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\$target
$target
Definition:
DirectDiscountDraftModel.php:36
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\setTarget
setTarget(?CartDiscountTarget $target)
Definition:
DirectDiscountDraftModel.php:105
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\setValue
setValue(?CartDiscountValueDraft $value)
Definition:
DirectDiscountDraftModel.php:97
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\__construct
__construct(?CartDiscountValueDraft $value=null, ?CartDiscountTarget $target=null)
Definition:
DirectDiscountDraftModel.php:42
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\CartDiscountValueDraftModel
Definition:
CartDiscountValueDraftModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
CartDiscountValueDraftModel.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\DirectDiscountDraft
Definition:
DirectDiscountDraft.php:17
Commercetools\Api\Models\CartDiscount\CartDiscountTarget
Definition:
CartDiscountTarget.php:15
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraft
Definition:
CartDiscountValueDraft.php:15
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1