commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CreatedByBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class CreatedByBuilder implements Builder
24{
29 private $clientId;
30
35 private $externalUserId;
36
41 private $customer;
42
47 private $anonymousId;
48
53 private $associate;
54
59 private $attributedTo;
60
67 public function getClientId()
68 {
69 return $this->clientId;
70 }
71
78 public function getExternalUserId()
79 {
80 return $this->externalUserId;
81 }
82
89 public function getCustomer()
90 {
91 return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
92 }
93
100 public function getAnonymousId()
101 {
102 return $this->anonymousId;
103 }
104
111 public function getAssociate()
112 {
113 return $this->associate instanceof CustomerReferenceBuilder ? $this->associate->build() : $this->associate;
114 }
115
122 public function getAttributedTo()
123 {
124 return $this->attributedTo instanceof AttributionBuilder ? $this->attributedTo->build() : $this->attributedTo;
125 }
126
131 public function withClientId(?string $clientId)
132 {
133 $this->clientId = $clientId;
134
135 return $this;
136 }
137
142 public function withExternalUserId(?string $externalUserId)
143 {
144 $this->externalUserId = $externalUserId;
145
146 return $this;
147 }
148
153 public function withCustomer(?CustomerReference $customer)
154 {
155 $this->customer = $customer;
156
157 return $this;
158 }
159
164 public function withAnonymousId(?string $anonymousId)
165 {
166 $this->anonymousId = $anonymousId;
167
168 return $this;
169 }
170
175 public function withAssociate(?CustomerReference $associate)
176 {
177 $this->associate = $associate;
178
179 return $this;
180 }
181
186 public function withAttributedTo(?Attribution $attributedTo)
187 {
188 $this->attributedTo = $attributedTo;
189
190 return $this;
191 }
192
198 {
199 $this->customer = $customer;
200
201 return $this;
202 }
203
209 {
210 $this->associate = $associate;
211
212 return $this;
213 }
214
219 public function withAttributedToBuilder(?AttributionBuilder $attributedTo)
220 {
221 $this->attributedTo = $attributedTo;
222
223 return $this;
224 }
225
226 public function build(): CreatedBy
227 {
228 return new CreatedByModel(
229 $this->clientId,
230 $this->externalUserId,
231 $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
232 $this->anonymousId,
233 $this->associate instanceof CustomerReferenceBuilder ? $this->associate->build() : $this->associate,
234 $this->attributedTo instanceof AttributionBuilder ? $this->attributedTo->build() : $this->attributedTo
235 );
236 }
237
238 public static function of(): CreatedByBuilder
239 {
240 return new self();
241 }
242}
withAssociateBuilder(?CustomerReferenceBuilder $associate)
withCustomerBuilder(?CustomerReferenceBuilder $customer)
withAttributedToBuilder(?AttributionBuilder $attributedTo)