commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DirectDiscountDraftBuilder.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\CartDiscountTargetBuilder
;
13
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraft
;
14
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftBuilder
;
15
use
Commercetools\Base\Builder
;
16
use
Commercetools\Base\DateTimeImmutableCollection
;
17
use
Commercetools\Base\JsonObject
;
18
use
Commercetools\Base\JsonObjectModel
;
19
use
Commercetools\Base\MapperFactory
;
20
use stdClass;
21
25
final
class
DirectDiscountDraftBuilder
implements
Builder
26
{
31
private
$value;
32
37
private
$target;
38
45
public
function
getValue
()
46
{
47
return
$this->value instanceof
CartDiscountValueDraftBuilder
? $this->value->
build
() : $this->value;
48
}
49
57
public
function
getTarget
()
58
{
59
return
$this->target instanceof
CartDiscountTargetBuilder
? $this->target->
build
() : $this->target;
60
}
61
66
public
function
withValue
(?
CartDiscountValueDraft
$value)
67
{
68
$this->value = $value;
69
70
return
$this;
71
}
72
77
public
function
withTarget
(?
CartDiscountTarget
$target)
78
{
79
$this->target = $target;
80
81
return
$this;
82
}
83
88
public
function
withValueBuilder
(?
CartDiscountValueDraftBuilder
$value)
89
{
90
$this->value = $value;
91
92
return
$this;
93
}
94
99
public
function
withTargetBuilder
(?
CartDiscountTargetBuilder
$target)
100
{
101
$this->target = $target;
102
103
return
$this;
104
}
105
106
public
function
build
():
DirectDiscountDraft
107
{
108
return
new
DirectDiscountDraftModel
(
109
$this->value instanceof
CartDiscountValueDraftBuilder
? $this->value->
build
() : $this->value,
110
$this->target instanceof
CartDiscountTargetBuilder
? $this->target->
build
() : $this->target
111
);
112
}
113
114
public
static
function
of
():
DirectDiscountDraftBuilder
115
{
116
return
new
self
();
117
}
118
}
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder
Definition:
DirectDiscountDraftBuilder.php:26
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\withTarget
withTarget(?CartDiscountTarget $target)
Definition:
DirectDiscountDraftBuilder.php:77
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\build
build()
Definition:
DirectDiscountDraftBuilder.php:106
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\getValue
getValue()
Definition:
DirectDiscountDraftBuilder.php:45
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\withValue
withValue(?CartDiscountValueDraft $value)
Definition:
DirectDiscountDraftBuilder.php:66
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\withTargetBuilder
withTargetBuilder(?CartDiscountTargetBuilder $target)
Definition:
DirectDiscountDraftBuilder.php:99
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\withValueBuilder
withValueBuilder(?CartDiscountValueDraftBuilder $value)
Definition:
DirectDiscountDraftBuilder.php:88
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\of
static of()
Definition:
DirectDiscountDraftBuilder.php:114
Commercetools\Api\Models\Cart\DirectDiscountDraftBuilder\getTarget
getTarget()
Definition:
DirectDiscountDraftBuilder.php:57
Commercetools\Api\Models\Cart\DirectDiscountDraftModel
Definition:
DirectDiscountDraftModel.php:25
Commercetools\Api\Models\CartDiscount\CartDiscountTargetBuilder
Definition:
CartDiscountTargetBuilder.php:22
Commercetools\Api\Models\CartDiscount\CartDiscountTargetBuilder\build
build()
Definition:
CartDiscountTargetBuilder.php:23
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftBuilder
Definition:
CartDiscountValueDraftBuilder.php:22
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftBuilder\build
build()
Definition:
CartDiscountValueDraftBuilder.php:23
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\Builder
Definition:
Builder.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1