commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MergeCartDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class MergeCartDraftBuilder implements Builder
22{
27 private $anonymousCart;
28
33 private $mergeMode;
34
39 private $updateProductData;
40
45 private $anonymousId;
46
53 public function getAnonymousCart()
54 {
55 return $this->anonymousCart instanceof CartResourceIdentifierBuilder ? $this->anonymousCart->build() : $this->anonymousCart;
56 }
57
64 public function getMergeMode()
65 {
66 return $this->mergeMode;
67 }
68
78 public function getUpdateProductData()
79 {
80 return $this->updateProductData;
81 }
82
90 public function getAnonymousId()
91 {
92 return $this->anonymousId;
93 }
94
99 public function withAnonymousCart(?CartResourceIdentifier $anonymousCart)
100 {
101 $this->anonymousCart = $anonymousCart;
102
103 return $this;
104 }
105
110 public function withMergeMode(?string $mergeMode)
111 {
112 $this->mergeMode = $mergeMode;
113
114 return $this;
115 }
116
121 public function withUpdateProductData(?bool $updateProductData)
122 {
123 $this->updateProductData = $updateProductData;
124
125 return $this;
126 }
127
132 public function withAnonymousId(?string $anonymousId)
133 {
134 $this->anonymousId = $anonymousId;
135
136 return $this;
137 }
138
144 {
145 $this->anonymousCart = $anonymousCart;
146
147 return $this;
148 }
149
150 public function build(): MergeCartDraft
151 {
152 return new MergeCartDraftModel(
153 $this->anonymousCart instanceof CartResourceIdentifierBuilder ? $this->anonymousCart->build() : $this->anonymousCart,
154 $this->mergeMode,
155 $this->updateProductData,
156 $this->anonymousId
157 );
158 }
159
160 public static function of(): MergeCartDraftBuilder
161 {
162 return new self();
163 }
164}
withAnonymousCartBuilder(?CartResourceIdentifierBuilder $anonymousCart)
withAnonymousCart(?CartResourceIdentifier $anonymousCart)