commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
ExternalLineItemTotalPriceModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\Common\Money
;
12
use
Commercetools\Api\Models\Common\MoneyModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
ExternalLineItemTotalPriceModel
extends
JsonObjectModel
implements
ExternalLineItemTotalPrice
23
{
28
protected
$price
;
29
34
protected
$totalPrice
;
35
36
40
public
function
__construct
(
41
?
Money
$price
=
null
,
42
?
Money
$totalPrice
=
null
43
) {
44
$this->price =
$price
;
45
$this->totalPrice =
$totalPrice
;
46
}
47
54
public
function
getPrice
()
55
{
56
if
(is_null($this->price)) {
58
$data = $this->
raw
(self::FIELD_PRICE);
59
if
(is_null($data)) {
60
return
null
;
61
}
62
63
$this->price =
MoneyModel::of
($data);
64
}
65
66
return
$this->price
;
67
}
68
75
public
function
getTotalPrice
()
76
{
77
if
(is_null($this->totalPrice)) {
79
$data = $this->
raw
(self::FIELD_TOTAL_PRICE);
80
if
(is_null($data)) {
81
return
null
;
82
}
83
84
$this->totalPrice =
MoneyModel::of
($data);
85
}
86
87
return
$this->totalPrice
;
88
}
89
90
94
public
function
setPrice
(?
Money
$price
): void
95
{
96
$this->price =
$price
;
97
}
98
102
public
function
setTotalPrice
(?
Money
$totalPrice
): void
103
{
104
$this->totalPrice =
$totalPrice
;
105
}
106
}
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel
Definition:
ExternalLineItemTotalPriceModel.php:23
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\getTotalPrice
getTotalPrice()
Definition:
ExternalLineItemTotalPriceModel.php:75
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\setPrice
setPrice(?Money $price)
Definition:
ExternalLineItemTotalPriceModel.php:94
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\$price
$price
Definition:
ExternalLineItemTotalPriceModel.php:28
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\__construct
__construct(?Money $price=null, ?Money $totalPrice=null)
Definition:
ExternalLineItemTotalPriceModel.php:40
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\$totalPrice
$totalPrice
Definition:
ExternalLineItemTotalPriceModel.php:34
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\getPrice
getPrice()
Definition:
ExternalLineItemTotalPriceModel.php:54
Commercetools\Api\Models\Cart\ExternalLineItemTotalPriceModel\setTotalPrice
setTotalPrice(?Money $totalPrice)
Definition:
ExternalLineItemTotalPriceModel.php:102
Commercetools\Api\Models\Common\MoneyModel
Definition:
MoneyModel.php:21
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
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\ExternalLineItemTotalPrice
Definition:
ExternalLineItemTotalPrice.php:16
Commercetools\Api\Models\Common\Money
Definition:
Money.php:15
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1