commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ExternalLineItemTotalPriceModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
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
55 public function getPrice()
56 {
57 if (is_null($this->price)) {
59 $data = $this->raw(self::FIELD_PRICE);
60 if (is_null($data)) {
61 return null;
62 }
63
64 $this->price = MoneyModel::of($data);
65 }
66
67 return $this->price;
68 }
69
76 public function getTotalPrice()
77 {
78 if (is_null($this->totalPrice)) {
80 $data = $this->raw(self::FIELD_TOTAL_PRICE);
81 if (is_null($data)) {
82 return null;
83 }
84
85 $this->totalPrice = MoneyModel::of($data);
86 }
87
88 return $this->totalPrice;
89 }
90
91
95 public function setPrice(?Money $price): void
96 {
97 $this->price = $price;
98 }
99
103 public function setTotalPrice(?Money $totalPrice): void
104 {
105 $this->totalPrice = $totalPrice;
106 }
107}