commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DirectDiscountBuilder.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\CartDiscountValue
;
14
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueBuilder
;
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
DirectDiscountBuilder
implements
Builder
26
{
31
private
$id;
32
37
private
$value;
38
43
private
$target;
44
51
public
function
getId
()
52
{
53
return
$this->id;
54
}
55
62
public
function
getValue
()
63
{
64
return
$this->value instanceof
CartDiscountValueBuilder
? $this->value->
build
() : $this->value;
65
}
66
74
public
function
getTarget
()
75
{
76
return
$this->target instanceof
CartDiscountTargetBuilder
? $this->target->
build
() : $this->target;
77
}
78
83
public
function
withId
(?
string
$id)
84
{
85
$this->
id
= $id;
86
87
return
$this;
88
}
89
94
public
function
withValue
(?
CartDiscountValue
$value)
95
{
96
$this->value = $value;
97
98
return
$this;
99
}
100
105
public
function
withTarget
(?
CartDiscountTarget
$target)
106
{
107
$this->target = $target;
108
109
return
$this;
110
}
111
116
public
function
withValueBuilder
(?
CartDiscountValueBuilder
$value)
117
{
118
$this->value = $value;
119
120
return
$this;
121
}
122
127
public
function
withTargetBuilder
(?
CartDiscountTargetBuilder
$target)
128
{
129
$this->target = $target;
130
131
return
$this;
132
}
133
134
public
function
build
():
DirectDiscount
135
{
136
return
new
DirectDiscountModel
(
137
$this->
id
,
138
$this->value instanceof
CartDiscountValueBuilder
? $this->value->
build
() : $this->value,
139
$this->target instanceof
CartDiscountTargetBuilder
? $this->target->
build
() : $this->target
140
);
141
}
142
143
public
static
function
of
():
DirectDiscountBuilder
144
{
145
return
new
self
();
146
}
147
}
Commercetools\Api\Models\Cart\DirectDiscountBuilder
Definition:
DirectDiscountBuilder.php:26
Commercetools\Api\Models\Cart\DirectDiscountBuilder\withTarget
withTarget(?CartDiscountTarget $target)
Definition:
DirectDiscountBuilder.php:105
Commercetools\Api\Models\Cart\DirectDiscountBuilder\getId
getId()
Definition:
DirectDiscountBuilder.php:51
Commercetools\Api\Models\Cart\DirectDiscountBuilder\getTarget
getTarget()
Definition:
DirectDiscountBuilder.php:74
Commercetools\Api\Models\Cart\DirectDiscountBuilder\build
build()
Definition:
DirectDiscountBuilder.php:134
Commercetools\Api\Models\Cart\DirectDiscountBuilder\withTargetBuilder
withTargetBuilder(?CartDiscountTargetBuilder $target)
Definition:
DirectDiscountBuilder.php:127
Commercetools\Api\Models\Cart\DirectDiscountBuilder\of
static of()
Definition:
DirectDiscountBuilder.php:143
Commercetools\Api\Models\Cart\DirectDiscountBuilder\withValue
withValue(?CartDiscountValue $value)
Definition:
DirectDiscountBuilder.php:94
Commercetools\Api\Models\Cart\DirectDiscountBuilder\getValue
getValue()
Definition:
DirectDiscountBuilder.php:62
Commercetools\Api\Models\Cart\DirectDiscountBuilder\withId
withId(?string $id)
Definition:
DirectDiscountBuilder.php:83
Commercetools\Api\Models\Cart\DirectDiscountBuilder\withValueBuilder
withValueBuilder(?CartDiscountValueBuilder $value)
Definition:
DirectDiscountBuilder.php:116
Commercetools\Api\Models\Cart\DirectDiscountModel
Definition:
DirectDiscountModel.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\CartDiscountValueBuilder
Definition:
CartDiscountValueBuilder.php:22
Commercetools\Api\Models\CartDiscount\CartDiscountValueBuilder\build
build()
Definition:
CartDiscountValueBuilder.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\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\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