commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DiscountedTotalPricePortionBuilder.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\CartDiscount\CartDiscountReference
;
12
use
Commercetools\Api\Models\CartDiscount\CartDiscountReferenceBuilder
;
13
use
Commercetools\Api\Models\Common\TypedMoney
;
14
use
Commercetools\Api\Models\Common\TypedMoneyBuilder
;
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
DiscountedTotalPricePortionBuilder
implements
Builder
26
{
31
private
$discount;
32
37
private
$discountedAmount;
38
45
public
function
getDiscount
()
46
{
47
return
$this->discount instanceof
CartDiscountReferenceBuilder
? $this->discount->
build
() : $this->discount;
48
}
49
56
public
function
getDiscountedAmount
()
57
{
58
return
$this->discountedAmount instanceof
TypedMoneyBuilder
? $this->discountedAmount->
build
() : $this->discountedAmount;
59
}
60
65
public
function
withDiscount
(?
CartDiscountReference
$discount)
66
{
67
$this->discount = $discount;
68
69
return
$this;
70
}
71
76
public
function
withDiscountedAmount
(?
TypedMoney
$discountedAmount)
77
{
78
$this->discountedAmount = $discountedAmount;
79
80
return
$this;
81
}
82
87
public
function
withDiscountBuilder
(?
CartDiscountReferenceBuilder
$discount)
88
{
89
$this->discount = $discount;
90
91
return
$this;
92
}
93
98
public
function
withDiscountedAmountBuilder
(?
TypedMoneyBuilder
$discountedAmount)
99
{
100
$this->discountedAmount = $discountedAmount;
101
102
return
$this;
103
}
104
105
public
function
build
():
DiscountedTotalPricePortion
106
{
107
return
new
DiscountedTotalPricePortionModel
(
108
$this->discount instanceof
CartDiscountReferenceBuilder
? $this->discount->
build
() : $this->discount,
109
$this->discountedAmount instanceof
TypedMoneyBuilder
? $this->discountedAmount->
build
() : $this->discountedAmount
110
);
111
}
112
113
public
static
function
of
():
DiscountedTotalPricePortionBuilder
114
{
115
return
new
self
();
116
}
117
}
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder
Definition:
DiscountedTotalPricePortionBuilder.php:26
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\withDiscount
withDiscount(?CartDiscountReference $discount)
Definition:
DiscountedTotalPricePortionBuilder.php:65
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\withDiscountedAmount
withDiscountedAmount(?TypedMoney $discountedAmount)
Definition:
DiscountedTotalPricePortionBuilder.php:76
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\withDiscountedAmountBuilder
withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount)
Definition:
DiscountedTotalPricePortionBuilder.php:98
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\withDiscountBuilder
withDiscountBuilder(?CartDiscountReferenceBuilder $discount)
Definition:
DiscountedTotalPricePortionBuilder.php:87
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\getDiscountedAmount
getDiscountedAmount()
Definition:
DiscountedTotalPricePortionBuilder.php:56
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\of
static of()
Definition:
DiscountedTotalPricePortionBuilder.php:113
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\build
build()
Definition:
DiscountedTotalPricePortionBuilder.php:105
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionBuilder\getDiscount
getDiscount()
Definition:
DiscountedTotalPricePortionBuilder.php:45
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel
Definition:
DiscountedTotalPricePortionModel.php:25
Commercetools\Api\Models\CartDiscount\CartDiscountReferenceBuilder
Definition:
CartDiscountReferenceBuilder.php:24
Commercetools\Api\Models\CartDiscount\CartDiscountReferenceBuilder\build
build()
Definition:
CartDiscountReferenceBuilder.php:92
Commercetools\Api\Models\Common\TypedMoneyBuilder
Definition:
TypedMoneyBuilder.php:22
Commercetools\Api\Models\Common\TypedMoneyBuilder\build
build()
Definition:
TypedMoneyBuilder.php:116
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\DiscountedTotalPricePortion
Definition:
DiscountedTotalPricePortion.php:17
Commercetools\Api\Models\CartDiscount\CartDiscountReference
Definition:
CartDiscountReference.php:16
Commercetools\Api\Models\Common\TypedMoney
Definition:
TypedMoney.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